home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / te2_134t.zip / TE2INST.006 / Script.Doc next >
Text File  |  1997-07-03  |  118KB  |  2,656 lines

  1.                                       TE/2 Script Language Reference
  2.  
  3.                                                      Oberon Software
  4.                                                1405 East Main Street
  5.                                               Mankato, MN 56001-5070
  6.  
  7.                                      Last Revision: October 24, 1995
  8.  
  9.  
  10.   -------------------------------------------------------------
  11.  
  12. Copyright 1990-95, Oberon Software, Mankato, MN - All Rights Reserved
  13.  
  14.   -------------------------------------------------------------
  15.  
  16.  
  17.  
  18.      ----------------------------------------------------
  19.  
  20. Notice:  Information in this document is subject to change without
  21. notice and does not constitute a commitment on the part of Oberon
  22. Software.
  23.  
  24.      ----------------------------------------------------
  25.  
  26.  
  27. General:
  28. ========
  29.  
  30.   A TE/2 script file is a flat ASCII file containing TE/2 script
  31. commands.  Each line in the file must be terminated with either a
  32. carriage return-line feed pair or with a single line feed.  No line
  33. may be longer than 256 characters in length, a line longer than 256
  34. characters will generate an error message and terminate execution of
  35. the script.
  36.  
  37.   The TE/2 script language is not case sensitive, identifiers,
  38. keywords, functions, et al may be entered in either upper or lower
  39. case in any mixture.  Identifier names (variables, subroutine names)
  40. have no formal length restriction except as relates to the line
  41. length restriction given above.
  42.  
  43.   Blank lines within the script file are ignored as are any leading
  44. or trailing space or tab characters on a line.  You may indent and
  45. space the file any way you please for readability purposes.  The
  46. semicolon is the comment mark character.  Any and all text on a line
  47. including and following a semicolon (;) is ignored.  The obvious
  48. exception to this is when the semicolon appears within a quoted
  49. string.
  50.  
  51.  
  52.  
  53. REXX/2 Language Scripts
  54. =======================
  55.  
  56. In addition to the script language syntax described in this document,
  57. you may also create your scripts using the REXX Procedure Language.
  58. You must be operating under a version of OS/2 which supports REXX to
  59. use this feature.  Because TE/2 sets itself up as the default addresssing
  60. environment when it executes a REXX procedure, all of the functions
  61. described later in this document are available also to the REXX
  62. script as are most of the TE/2 built-in and system variables.  You are
  63. referred to the section of this document titled "Notes on REXX Scripts"
  64. for further information.
  65.  
  66.  
  67.  
  68. Executing a script:
  69. ===================
  70.  
  71.   A script file may be executed in one of four ways:
  72.  
  73.     1) Type Alt-/ (Alt-Slash) in terminal mode, at the "Command:"
  74. prompt type "call filename" where filename is the full file name
  75. (including path and extension) of the script to execute.
  76.  
  77.     2) Associate a script file name (once again, full path and
  78. extension) with a dialing directory entry and make connection with
  79. that number.
  80.  
  81.     3) Assign the "call" command to a TE/2 function key.  Set the
  82. macro associated with the function to to "!call filename".  Note
  83. that ANY script command may be associated with a function key using
  84. the exclamation point as the leading character.
  85.  
  86.     4) Run a script automatically when TE/2 starts using the
  87. "-mfilename" command line parameter.  Note that there is one "magic"
  88. script file name "TE2START.SCR" which TE/2 will always execute
  89. automatically at startup if it finds it on the script path.
  90.  
  91.  
  92. Parameters for script files:
  93. ============================
  94.  
  95. Both the RUN() statement and the "CALL" pseudo statement allow for
  96. parameters which will be passed to the script file.  A TE/2 script language
  97. script may retrieve these by querying the read-only string variable:
  98. "ScriptArgs".  The entire parameter line will be in this variable and it is
  99. the responsibility of the script to parse it as it sees fit.  A REXX
  100. language TE/2 script retrieves the parameters via the standard PARSE ARG
  101. methods.
  102.  
  103. Note that the RUN() statement accepts either one or two string parameters.
  104. RUN("MyScript", "Arg1 Arg2") will execute "MyScript" and place "Arg1 Arg2"
  105. in ScriptArgs.  The statement RUN("MyScript") is also legal and it is
  106. equivalent to RUN("MyScript", "").
  107.  
  108. When you use CALL from the TE/2 Alt-/ Command Prompt, any non-space
  109. characters after the script name will be taken as script parameters.
  110. Leading spaces are stripped from the parameter string but not trailing ones.
  111. Note that because the space is used as a delimiter here you cannot CALL a
  112. script with a space in its file name.
  113.  
  114. You can specify a parameter string to a script started via TE/2's command
  115. line "-m" switch by using "-a".  Example:
  116.  
  117.           TE2 -mMyScript "-aArg1 Arg2"
  118.  
  119. Similarly, you can pass parameters to TE2START.SCR using "-u".
  120.  
  121.  
  122. Program structure:
  123. ==================
  124.  
  125.   The general structure of a TE/2 script file is thus:
  126.  
  127.         variable declarations/definitions
  128.         subroutine definitions
  129.         program body
  130.  
  131.  
  132.  
  133. Constants:
  134. ==========
  135.  
  136.   Numeric Constants
  137.   -----------------
  138.  
  139.   Numeric constants are 32 bit, signed quantities.  A numeric constant
  140. may be expressed in standard decimal, hexadecimal, or octal notation
  141. and may range from -2147483647 to 2147483647.  Some examples of numeric
  142. constants are:
  143.                32, -768, 0x1b, 0333, 0x12345678
  144.  
  145.   There are several built in numeric constants. The most important of
  146. these are TRUE (1) and FALSE (0). There are others that are designed
  147. for special purposes, these will be covered in the appropriate
  148. sections.  Table 1 contains a list of these constants.
  149.  
  150.     Table 1.  -- Built in numeric constants
  151.     ---------------------------------------
  152.                     ansi_bbs
  153.                     ansi_te2
  154.                     ascii
  155.                     false
  156.                     ifcarrier
  157.                     query
  158.                     toggle
  159.                     true
  160.                     tty
  161.                     vt100
  162.                     xmodem
  163.                     xmodem1k
  164.                     ymodem
  165.                     ymodemg
  166.                     zmodem
  167.  
  168.  
  169.   Character Constants
  170.   -------------------
  171.  
  172.   Character constants are really just a special method of specifying
  173. an numeric constant.  A character constant is any single character
  174. between a pair of single quote marks (') or any two character Control
  175. Character sequence (See Table 2. below) between a pair of single
  176. quotes.  The result is the ASCII value of the specified character and
  177. it may be used anywhere a numeric constant or variable is allowed.
  178. To specify the ASCII value of the single quote character (39), simply
  179. use a sequence of three single quotes.
  180.  
  181.   Note that the character constant 'A' is exactly equal to ASCIIVAL("A")
  182. (See function ASCIIVAL below).
  183.  
  184.  
  185.  
  186.   String Constants
  187.   ----------------
  188.  
  189.   String constants are any string of ASCII characters delimited
  190. before and after with double quote marks (").  To embed a quote mark
  191. in a string use a sequence of two double quotes.  For example:
  192.  
  193.         "This string has ""quotes"" embedded into it."
  194.  
  195.   String constants should not exceed 256 characters in length.  This
  196. is not a hard and fast rule though exception handling for long
  197. strings may be less than robust at this point.
  198.  
  199.   The carat (^) character is treated specially, use it to embed
  200. control characters into a string. Table 2 lists all of the valid
  201. conversions.  If a carat character appears in any other situation in
  202. a quoted string it is ignored.  Note that ^! yields character 94
  203. which is itself the carat character, thus "^!" is the method of
  204. embedding the carat character itself into a string.  "^`" is a space
  205. character, this is interesting but not very useful.
  206.  
  207.  
  208.     Table 2.  -- Control character conversions
  209.     --------------------------------------------------------------
  210.        ^@         0        ^L or ^l  12       ^X or ^x  24
  211.        ^A or ^a   1        ^M or ^m  13       ^Y or ^y  25
  212.        ^B or ^b   2        ^N or ^n  14       ^Z or ^z  26
  213.        ^C or ^c   3        ^O or ^o  15       ^[        27
  214.        ^D or ^d   4        ^P or ^p  16       ^\        28
  215.        ^E or ^e   5        ^Q or ^q  17       ^]        29
  216.        ^F or ^f   6        ^R or ^r  18       ^^        30
  217.        ^G or ^g   7        ^S or ^s  19       ^_        31
  218.        ^H or ^h   8        ^T or ^t  20       ^`        32
  219.        ^I or ^i   9        ^U or ^u  21       ^!        94
  220.        ^J or ^j  10        ^V or ^v  22
  221.        ^K or ^k  11        ^W or ^w  23
  222.  
  223.  
  224.   There is one built in string constant, "null" which specifies the
  225. absence of a string.  Note that "null" is not the same as the string
  226. constant "".  The later is a representation of the empty string
  227. whereas "null" is no string at all; several functions in the TE/2
  228. script language will make a distinction.
  229.  
  230.  
  231. Variables:
  232. ==========
  233.  
  234.   Variable types and scope:
  235.   -------------------------
  236.  
  237.   User defined variables may be either string or integer variables.
  238. An integer variable is capable of holding a signed, 32 bit quantity -
  239. the same as the numeric constants mentioned above while a string
  240. variable may refer to anything expressible with a string constant.
  241.  
  242.   Variables may be local or global in scope.  If a variable is local,
  243. it is in effect for the current script file only; it is released when
  244. the script file ends execution and it is not available in any nested
  245. script file execution.  If a variable is global, it is in effect from
  246. the instant it is declared until TE/2 ends execution and exits back
  247. to the OS/2 prompt and it is available to any script file that
  248. executes thereafter and may even be used at the "Command:" prompt.
  249.  
  250.  
  251.   Declaring variables:
  252.   --------------------
  253.  
  254.   Variables are declared in the first section of the script file,
  255. anywhere before the "PROGRAM" statement except in a "SUBROUTINE"
  256. .. "ENDSUB" block.  A variable declaration has the following form:
  257.  
  258.         [GLOBAL] type name [ = expression ]
  259.  
  260.   If the "GLOBAL" scoping modifier is omitted, the variable is local
  261. in scope.  "type" is either "INTEGER" or "STRING".  A variable name
  262. must begin with an alphabetic character ("A" through "Z"), be
  263. comprised entirely of alphanumeric characters ("A" through "Z" plus
  264. "0" through "9"), and must not conflict with a TE/2 keyword or
  265. predefined variable.  If a GLOBAL variable name coincides with
  266. another GLOBAL variable already defined in another script file, it
  267. will refer to the same entity.  If a LOCAL variable has the same name
  268. as an already defined GLOBAL variable, it takes precedence over the
  269. GLOBAL variable for the duration of the current script file after
  270. which the GLOBAL variable will be reinstated.
  271.  
  272.   The optional initializing expression follows all of the rules given
  273. below for expressions.  Remember that it can't refer to any variables
  274. which are not yet declared.
  275.  
  276.  
  277. Subroutines:
  278. ============
  279.  
  280.   All subroutines must be defined before the "PROGRAM" statement in
  281. the script file.  The general form of a subroutine is:
  282.  
  283.         SUBROUTINE name
  284.           statements
  285.         ENDSUB
  286.  
  287. A subroutine name must begin with an alphabetic character and be
  288. composed entirely of alphanumeric characters.  Unlike variables, the
  289. name may conflict with a TE/2 script language keyword or a variable
  290. name but not with any other subroutine name in that script file.
  291.  
  292.   Rules for the statements in a subroutine are the same as the
  293. general rules given below except that the "RETURN" statement is only
  294. valid within a subroutine.  The "RETURN" statement is not strictly
  295. needed, the subroutine will exit back to the main line of code when
  296. it reaches the "ENDSUB" statement but the "RETURN" statement may be
  297. used to exit the subroutine early.
  298.  
  299.   A subroutine has access to all of the local variables defined in
  300. the script file even though they may have been declared later in the
  301. file.
  302.  
  303.  
  304.  
  305. Program body:
  306. =============
  307.  
  308.   After all variable declarations and subroutine definitions, the
  309. keyword "PROGRAM" is used to indicate the beginning of the main
  310. program body of the script file.  Execution of the script begins at
  311. the very next statement after the "PROGRAM" directive.  The program
  312. is composed of one or more statements.
  313.  
  314.  
  315. Statements:
  316. ===========
  317.  
  318.   A statement may be one of the following:
  319.         an assignment statement
  320.         a TE/2 function call
  321.         a control statement
  322.  
  323.  
  324.   Assignment statements:
  325.   ----------------------
  326.  
  327.   An assignment statement has the following form:
  328.  
  329.         variablename = expression
  330.  
  331. "variablename" must be the name of any LOCAL variable declared within
  332. that script file, any GLOBAL variable declared within some script
  333. file that has executed during this TE/2 session, or any TE/2
  334. system-global variable that is not specifically read-only (see list of
  335. keywords and system variables below).
  336.  
  337.   Depending on the type (INTEGER or STRING) of the variable on the
  338. left hand side, the expression may take either of the following
  339. forms:
  340.  
  341.     String expressions
  342.     ------------------
  343.  
  344.         Either a string variable, string literal, or string valued
  345.       function or the addition (concatenation) of two or more such
  346.       variables, literals or functions.
  347.  
  348.         Examples:
  349.                 stringvar = "fred flinstone"
  350.                 HelloMsg  = "Hello " + strleft("Worldwide", 5) + "^M^J"
  351.  
  352.  
  353.     Integer expressions
  354.     -------------------
  355.  
  356.         Either an integer variable, numeric constant, or integer
  357.       valued function or the algebraic combination of two or more
  358.       such variables, constants, or functions.
  359.  
  360.         Examples:
  361.                 intvar = 12345
  362.                 area = width * length
  363.                 loword = longval & 0x0000ffff
  364.  
  365.         The following operators are available for use in integer
  366.       expressions, given in the order of precedence.  Parenthesis
  367.       may be freely used to ensure the correct order of evaluation
  368.       and/or for clarity and readability.
  369.  
  370.       Table 3. -- Integer arithmetic operators
  371.       ----------------------------------------
  372.             -    Unary minus
  373.             ~    Unary bitwise negation
  374.             !    Unary logical negation
  375.  
  376.             &    Bitwise AND operator
  377.  
  378.             |    Bitwise OR operator
  379.             ^    Bitwise EXCLUSIVE-OR operator
  380.  
  381.             >>   Bitwise shift-right
  382.             <<   Bitwise shift-left
  383.  
  384.             *    Multiplication
  385.             /    Division
  386.             %    Modulus
  387.  
  388.             +    Addition
  389.             -    Subtraction
  390.  
  391.             AND  Logical AND
  392.             OR   Logical OR
  393.  
  394.             >    Relational Greater-Than
  395.             <    Relational Less-Than
  396.             >=   Relational Greater-Than-Or-Equal
  397.             <=   Relational Less-Than-Or-Equal
  398.             !=   Relational Not-Equal
  399.             ==   Relational Equality
  400.  
  401.  
  402.  
  403.   TE/2 Function calls:
  404.   --------------------
  405.  
  406.   The TE/2 script file language has a rich set of built in functions
  407. which are listed alphabetically below in the Function Directory.  In
  408. general, each function has a return value, either INTEGER or STRING
  409. and may appear in the right hand side of an expression as discussed
  410. above but a function (indeed an entire expression, see below) may also
  411. appear on a line of its own in the script file.  In this case the
  412. function is evaluated (usually for its actions or side effects) and
  413. the return value is discarded.  Clearly, this is not advantageous for
  414. some functions such as GETENV or STRLEN whose entire purpose in life
  415. is to return some information however it may be just the ticket for
  416. action functions like CHAT, SCROLLBACK, or even WAITFOR if you aren't
  417. interested in the return value.
  418.  
  419.   It was mentioned that an entire expression could appear on a line
  420. in the script file.  The following is a perfectly valid statement:
  421.  
  422.         waitfor("Select:", 60) + 5 + atoi("1234")
  423.  
  424. however the result (1239 or 1240 if WAITFOR was successful) will be
  425. discarded.  You might be tempted to write:
  426.  
  427.         waitfor("Select:", 60) + transmit("m^M")
  428.  
  429. instead of:
  430.  
  431.         waitfor("Select:", 60)
  432.         transmit("m^M")
  433.  
  434. however you should NOT depend on left-to-right evaluation of this
  435. or any expression as it may not be the case in future versions of
  436. TE/2 or in the compiled language when it become available. 
  437. Likewise, Boolean statements (those which use AND, OR, the logical
  438. negation (!), and/or the relational operators are NOT short circuited
  439. once their results are clear (as they are in "C", for instance);
  440. expect all terms of a Boolean expression to be evaluated.
  441.  
  442.  
  443.   Control statements:
  444.   -------------------
  445.  
  446.   The following is a brief summary of the program control structures
  447. available in the TE/2 script language.
  448.  
  449.       Subroutines:
  450.       ------------
  451.  
  452.         GOSUB subname           { subname must be defined in file }
  453.         RETURN                  { valid within a subroutine only }
  454.  
  455.                 Notes: The subroutine has access to all variables
  456.                 that are available at the main line level.  The
  457.                 program location after the GOSUB statement is saved
  458.                 and restored when the RETURN statement is encountered
  459.                 or when an ENDSUB statement is reached.  Subroutines
  460.                 may call other subroutines in the same file. The END
  461.                 statement may be used within the subroutine with the
  462.                 same results as using it in the main program body.
  463.  
  464.  
  465.       IF-ELSEIF-ELSE structure:
  466.       -------------------------
  467.  
  468.         IF num-expression
  469.           statements
  470.         [ELSEIF num-expression  { any number of ELSEIF clauses are }
  471.           statements            { allowed }
  472.         ELSEIF num-expression
  473.           .
  474.           .]
  475.         [ELSE                   { ELSE statement is optional }
  476.           statements]
  477.         ENDIF
  478.  
  479.  
  480.  
  481.       Loop structures:
  482.       ----------------
  483.  
  484.         DO                      { loop forever }
  485.           statements
  486.         LOOP
  487.  
  488.         DO WHILE num-expression
  489.           statements
  490.         LOOP
  491.  
  492.         DO UNTIL num-expression
  493.           statements
  494.         LOOP
  495.  
  496.         DO
  497.           statements
  498.         LOOP WHILE num-expression
  499.  
  500.         DO
  501.           statements
  502.         LOOP UNTIL num-expression
  503.  
  504.         BREAK                   { exit current loop structure }
  505.         CONTINUE                { branch to top of current loop structure }
  506.  
  507.                 Notes: In the DO WHILE..LOOP and DO UNTIL..LOOP
  508.                 structures, the control expression is evaluated at
  509.                 the beginning of the loop, execution may never enter
  510.                 the loop if the expression does not evaluate
  511.                 correctly for that style of loop.  In the DO..LOOP
  512.                 WHILE and DO..LOOP UNTIL forms, the expression is
  513.                 evaluated at the end of the loop, the loop will
  514.                 always be executed at least once.
  515.                 The BREAK statement will exit the current loop
  516.                 structure.  If execution is within nested loops, only
  517.                 the innermost loop will be exited.  The BREAK
  518.                 statement is the only way to exit the first form of
  519.                 the DO..LOOP structure.
  520.                 The CONTINUE statement transfers control back to the
  521.                 top of the loop structure.  If it is of the form
  522.                 DO WHILE..LOOP or DO UNTIL..LOOP, the expression is
  523.                 immediately reevaluated.
  524.  
  525.  
  526.       Other controls:
  527.       ---------------
  528.  
  529.         END                     { terminate current script file even
  530.                                   if currently in subroutine }
  531.  
  532.         STOP                    { terminate current script file and
  533.                                   all calling script files }
  534.  
  535.         RUN(str-expression)     { execute script file - control
  536.                                   returns to current file when called
  537.                                   file ends }
  538.             -- or --
  539.  
  540.         RUN(str-expression, str-expression)
  541.                                 { execute script file with supplied
  542.                                   parameters - control returns to current
  543.                                   file when called file ends }
  544.  
  545.         PROCESS                 { recursively execute a TE/2 terminal
  546.                                   session, script file is suspended
  547.                                   until an EXIT() is performed. Note
  548.                                   that Alt-X generates an EXIT() by
  549.                                   default }
  550.  
  551.         EXIT(num-expression)    { terminate current PROCESS level or
  552.                                   terminate TE/2 if not in a PROCESS
  553.                                   shell }
  554.  
  555.   Note that the END statement is not strictly necessary, the script
  556. file will terminate when it reaches the end of the file.
  557.  
  558.   Please note that loop structures, IF blocks and subroutines must be
  559. properly nested.  The TE/2 script language interpreter may detect a
  560. faulty nesting and terminate with an error but the problem may not be
  561. detected in some pathological cases until execution has already
  562. progressed in an erroneous manner for a while.  The following are
  563. examples of incorrect block nesting.
  564.  
  565.     Incorrect nesting:
  566.     ------------------
  567.         counter = 0
  568.         do while counter < 50
  569.           if counter == 25
  570.             loop
  571.           endif
  572.           counter = counter + waitfor("Next", 10)
  573.         loop
  574.  
  575.     Correct nesting:
  576.     ----------------
  577.         counter = 0
  578.         do while counter < 50
  579.           if counter == 25
  580.             continue
  581.           endif
  582.           counter = counter + waitfor("Next", 10)
  583.         loop
  584.  
  585.           
  586.     Incorrect nesting:
  587.     ------------------
  588.         if stricmp(strg1, strg2) == 0
  589.           message("^M^Jwaiting")
  590.           do
  591.             message(".")
  592.         else
  593.             message("!")
  594.           until waitfor(strg2, 1)
  595.         endif
  596.  
  597.  
  598.  
  599. Keywords:
  600. =========
  601.  
  602.   No user variable may have the same name as a TE/2 control word,
  603. built-in numeric constant, built-in system global variable, or TE/2
  604. function call.  Please refer to each specific list.
  605.  
  606.  
  607.  
  608. TE/2 System-Global Variables:
  609. =============================
  610.  
  611.   The following are the system-global variables (those which are
  612. usually set in TE2.INI) which may be referred to in script language
  613. statements.  The type (INTEGER or STRING) of each is given by its
  614. name.  In general, these variables may also appear on the left-hand
  615. side of an assignment statement, i.e.:
  616.  
  617.         modemInitStrg = "ATE0 V1 X6^M^J"
  618.  
  619. Those which cannot be assigned directly are marked with an asterisk.
  620. The marked variables must be set/reset through other means (usually a
  621. function is provided, in some cases only through a TE/2 dialog box or
  622. only from TE2.INI).
  623.  
  624.     Table 5. -- TE/2 system-global variables
  625.     ----------------------------------------------
  626.      * indicates read-only variable w.r.t assignment statements
  627.  
  628.         TermAttr           - INTEGER
  629.         MenuNormAttr       - INTEGER
  630.         MenuHiAttr         - INTEGER
  631.         LogoAttr           - INTEGER
  632.         DLogNormAttr       - INTEGER
  633.         DLogHiAttr         - INTEGER
  634.         DLogDaAttr         - INTEGER
  635.         DLogEdAttr         - INTEGER
  636.         DLogEdHiAttr       - INTEGER
  637.         ShadowAttr         - INTEGER
  638.         DialNormAttr       - INTEGER
  639.         DialHiAttr         - INTEGER
  640.         ErrorAttr          - INTEGER
  641.         ScrlBackAttr       - INTEGER
  642.         ScrlBackFdAttr     - INTEGER
  643.         ScrlBackMkAttr     - INTEGER
  644.         ScrlBackTiAttr     - INTEGER
  645.         ChatAttr           - INTEGER
  646.         ChatRemoteAttr     - INTEGER
  647.         ChatTitleAttr      - INTEGER
  648.         CmdPromptAttr      - INTEGER
  649.         CmdInputAttr       - INTEGER
  650.         CmdInputHiAttr     - INTEGER
  651.         SnapShotAttr       - INTEGER
  652.  
  653.         LocalEcho          - INTEGER
  654.         DtrHangUp          - INTEGER
  655.         LFafterCR          - INTEGER
  656.         AutoZM             - INTEGER
  657.         MatchBaud          - INTEGER
  658.         AutoDirSave        - INTEGER
  659.         ChatBuffered       - INTEGER
  660.         Te2DEBUG           - INTEGER
  661.         AlarmPopUp         - INTEGER
  662.         MenuActive         - INTEGER *
  663.         ColorLock          - INTEGER
  664.         ClsReset           - INTEGER
  665.         QueryZMRecover     - INTEGER
  666.         DialerDC           - INTEGER
  667.         AutoNL3101         - INTEGER
  668.         AutoLF3101         - INTEGER
  669.         Scroll3101         - INTEGER
  670.         EndChar3101        - INTEGER
  671.         NoOvIO             - INTEGER
  672.         ExtendedFIFO       - INTEGER *
  673.         SwapBS4Del         - INTEGER
  674.         VT100Backspace     - INTEGER *
  675.         SetVTDefAttr       - INTEGER
  676.         CursorTop          - INTEGER *
  677.         CursorBottom       - INTEGER *
  678.         NoHPFSSalvage      - INTEGER
  679.         NoExtSalvage       - INTEGER
  680.         SalvageBrkCh       - INTEGER
  681.  
  682.         BreakLen           - INTEGER
  683.         DialerTimeOut      - INTEGER
  684.         AlarmType          - INTEGER
  685.         AlarmTime          - INTEGER
  686.         ForceLines         - INTEGER
  687.         ScrlBackLns        - INTEGER *
  688.         RedialDelay        - INTEGER
  689.         LogoDelay          - INTEGER
  690.         QueryHangUp        - INTEGER
  691.         ClobberDL          - INTEGER
  692.         DialerSendInit     - INTEGER
  693.  
  694.         ANSI8Bit           - INTEGER          
  695.         ANSIBackspace      - INTEGER          
  696.         Chime15            - INTEGER 
  697.         Chime5             - INTEGER 
  698.         Chime60            - INTEGER 
  699.         CommShared         - INTEGER * 
  700.         DialCheckDCD       - INTEGER 
  701.         ErrorPopUp         - INTEGER 
  702.         MaxReDials         - INTEGER 
  703.         MenuActive         - INTEGER *
  704.         StatBarAttr        - INTEGER 
  705.         Telnet             - INTEGER 
  706.         TelnetDebug        - INTEGER 
  707.         AsciiULIndent      - INTEGER 
  708.         LinkRateDisplay    - INTEGER 
  709.         HoldXmit           - INTEGER 
  710.  
  711.         Chime15WAV         - STRING 
  712.         Chime5WAV          - STRING 
  713.         Chime60WAV         - STRING 
  714.         ChimeWAV           - STRING 
  715.         DialingWAV         - STRING 
  716.         EndingWAV          - STRING 
  717.         KeyMapFile         - STRING *
  718.         StartupWAV         - STRING 
  719.         TE2Menu            - STRING *
  720.         TE2Pipe            - STRING *
  721.         XEXDnloadFile      - STRING *
  722.         XEXUploadFile      - STRING *
  723.         XferFailWAV        - STRING 
  724.         XferStartWAV       - STRING 
  725.         XferSuccessWAV     - STRING 
  726.  
  727.         ModemInitStrg      - STRING
  728.         ModemDialStrg      - STRING
  729.         ModemDialSufx      - STRING
  730.         ModemHangStrg      - STRING
  731.         ModemAnsStrg       - STRING
  732.         ModemOKStrg        - STRING
  733.         ModemDelayChar     - INTEGER
  734.         EnqReply           - STRING
  735.         VT100Prn           - STRING
  736.  
  737.         CallLog            - STRING  *
  738.         LogPath            - STRING
  739.         UploadPath         - STRING
  740.         DownloadPath       - STRING
  741.         ScriptPath         - STRING
  742.         ShellCmd           - STRING
  743.         DIRFile            - STRING *
  744.         FNKFile            - STRING *
  745.         XEXFile            - STRING *
  746.  
  747.         Device             - STRING  *
  748.         Port               - INTEGER *
  749.         Baud               - INTEGER *
  750.         Parity             - INTEGER *
  751.         WordLen            - INTEGER *
  752.         StopBits           - INTEGER *
  753.         XonXoff            - INTEGER *
  754.         CtsRts             - INTEGER *
  755.  
  756.         ULPrtyClass        - INTEGER
  757.         DLPrtyClass        - INTEGER
  758.  
  759.  
  760. Other System variables:
  761. =======================
  762.  
  763.   The following are other read-only variables, maintained by the
  764. system which may not be set in any way.  Their values may only be
  765. examined.
  766.  
  767.          Connected    - INTEGER, TRUE if TE/2 is online
  768.          CurDir       - STRING, the current subdirectory
  769.          CursorCol    - INTEGER, current horizontal postion of the
  770.                           cursor, leftmost column is 0
  771.          CursorRow    - INTEGER, current vertical position of the
  772.                           cursor, topmost row is 0
  773.          Emulation    - INTEGER, current terminal emulation mode:
  774.                           0 -> TTY
  775.                           1 -> ANSI-BBS
  776.                           2 -> ANSI-TE/2
  777.                           3 -> VT100
  778.                           4 -> IBM 3101
  779.          Fullscreen   - INTEGER, 1 if TE/2 is running in a fullscreen
  780.                           session, 0 if windowed.
  781.          ScreenRows   - INTEGER, number of rows on the current physical
  782.                           screen
  783.          ScreenCols   - INTEGER, number of columns on the current physical
  784.                           screen
  785.          Date         - INTEGER, the current date in packed format
  786.          Time         - INTEGER, the current time in packed format
  787.          TimedOut     - INTEGER, TRUE if last WAITFOR, MUXWAIT, RGETS
  788.                           ended because of a timeout
  789.          KbdAbort     - INTEGER, TRUE if last WAITFOR, MUXWAIT, RGETS
  790.                           ended because of ESCape was typed
  791.          KeyPressed   - INTEGER, TRUE if a local keystroke is pending
  792.          LastUpload   - STRING, the name of the most recently uploaded
  793.                           file or "" if no uploads have occurred
  794.          LastDownload - STRING, the name of the most recently downloaded
  795.                           file or "" if no downloads have occurred
  796.          Porthandle   - INTEGER, the OS/2 file handle for the open com port
  797.          StrDate      - STRING, the current date in string format
  798.          StrTime      - STRING, the current time in string format
  799.          Weekday      - STRING, the current day of the week, one
  800.                           of: "Sun", "Mon", "Tue", "Wed", "Thu",
  801.                           "Fri", or "Sat".
  802.          StartScr     - STRING, the name of the script which was started
  803.                           on the TE/2 command line via "-m<scriptfile>",
  804.                           if any.
  805.          RexxRC       - INTEGER, the return code from the last executed
  806.                           REXX language script.
  807.  
  808.   Note: the formats of the date and time strings are determined by
  809. querying OS/2 for the current codepage.
  810.  
  811.   Note: the formats of the date and time numeric variables are:
  812.  
  813.           year   = (date & 0xffff0000) >> 16
  814.           month  = (date & 0x0000ff00) >> 8
  815.           day    =  date & 0x000000ff
  816.  
  817.           hour   = (time & 0xff000000) >> 24
  818.           minute = (time & 0x00ff0000) >> 16
  819.           second = (time & 0x0000ff00) >> 8
  820.           hunds  =  time & 0x000000ff
  821.  
  822.  
  823.  
  824.  
  825. Function directory:
  826. ===================
  827.  
  828.   All functions are invoked by giving their names plus a pair of
  829. parentheses containing the list of arguments.  In some cases, a
  830. function may not require an argument list, in these cases the empty
  831. parentheses are still required.
  832.  
  833.   In the function directory below, the format is: the function name
  834. is listed and, in the parentheses, the type of each required argument
  835. is given.  If no arguments are required, the word "void" appears in
  836. the parentheses.  Some functions receive "special" parameters;
  837. usually these will be taken from a select set of predefined constants
  838. (as mentioned in the section on constants above).  In these cases,
  839. the word "special" will appear in that argument position and an
  840. explanation will be given in the text.  If a function takes a
  841. variable number of arguments, this is indicated by ending the
  842. argument list with three dots ("...").
  843.  
  844.  
  845.     ABS(integer)
  846.         Returns: INTEGER, the absolute value of its argument
  847.  
  848.  
  849.     ASCIIVAL(string)
  850.         Returns: INTEGER, the ASCII value of the first character of
  851.                           its argument
  852.  
  853.  
  854.     ATOI(string)
  855.         Returns: INTEGER, the numeric value of the argument
  856.         Notes:  this function understands hex and octal notation,
  857.                 thus ATOI("27") and ATOI("0x1b") and ATOI("033")
  858.                 all return the same value, 27.
  859.  
  860.  
  861.     BEEP(integer, integer)
  862.         Returns: INTEGER, always TRUE
  863.         Notes:  this function will sound the console beeper, the
  864.                 first parameter specifies the frequency (pitch) of
  865.                 the sound, the second the duration.
  866.  
  867.  
  868.     CANCELWATCH(integer)
  869.         Returns: INTEGER, TRUE or FALSE
  870.         Notes:  The argument must be a 'watch handle' created via a
  871.                 previous call to WATCHFOR.  This function releases
  872.                 the watch.  It returns FALSE if the watch did not
  873.                 exist, TRUE otherwise.
  874.                 See also WATCHFOR.
  875.  
  876.     CHAT(void)
  877.         Returns: INTEGER, always TRUE
  878.         Notes:  Activates chat mode, same as Alt-G from terminal mode
  879.  
  880.  
  881.     CHDIR(string)
  882.         Returns: INTEGER, TRUE or FALSE
  883.         Notes:  the argument specifies a subdirectory, this function
  884.                 will attempt to change the current working directory
  885.                 on the current or specified disk, it will NOT change
  886.                 the currently logged disk however.  CHDIR returns
  887.                 TRUE if it was successful. (See CHDISK)
  888.         Examples:
  889.                 CHDIR("D:\")
  890.                 CHDIR("\comm\log")
  891.  
  892.  
  893.     CHDISK(string)
  894.         Returns: INTEGER, TRUE or FALSE
  895.         Notes:  the first character of the argument should specify a
  896.                 disk letter.  This function will attempt to make that
  897.                 the current drive.  It returns TRUE if it was
  898.                 successful. (See CHDIR)
  899.  
  900.  
  901.     CLOSEDIALOG(integer)
  902.         Returns: INTEGER, always TRUE
  903.         Notes:  The argument MUST be a handle to a dialog that has
  904.                 been created by an earlier call to OPENDIALOG.
  905.                 Restores the area of the screen which was saved during
  906.                 the OPENDIALOG call and frees up all memory associated
  907.                 with this dialog.
  908.  
  909.  
  910.     CLS(void)
  911.         Returns: INTEGER, always TRUE
  912.         Notes:  Clears the terminal screen to the current attribute.
  913.  
  914.  
  915.     CRC16(string, integer)
  916.         Returns: INTEGER
  917.         Notes: The numeric parameter specifies the how many bytes of
  918.                the string to consider, if set to -1 then the entire
  919.                string is used.  The function returns the 16-bit CRC
  920.                for the string.
  921.  
  922.     CRC32(string, integer)
  923.         Returns: INTEGER
  924.         Notes: The numeric parameter specifies the how many bytes of
  925.                the string to consider, if set to -1 then the entire
  926.                string is used.  The function returns the 32-bit CRC
  927.                for the string.
  928.  
  929.     DIAL(string OR integer)
  930.         Returns: INTEGER, TRUE or FALSE
  931.         Notes:  If the argument is an integer or if it is a string
  932.                 with the format "#nnn" where the n's are digits, DIAL
  933.                 will attempt to dial the indicated entry in the
  934.                 current dialing directory.  If it is a string and
  935.                 not "#nnn" format, then if the first character is a
  936.                 digit it will manually dial the string, else if the
  937.                 string is not empty it will search for a TAG in the
  938.                 current dialing directory that matches and dial that
  939.                 entry.  If the string is empty, the user is prompted
  940.                 for a number (this is equivalent to typing Alt-M from
  941.                 terminal mode).  DIAL returns TRUE if a connection
  942.                 was made.
  943.  
  944.  
  945.     DIRECTORY(void)
  946.         Returns: INTEGER, TRUE or FALSE
  947.         Notes:  This is equivalent to typing Alt-D from terminal
  948.                 mode.  DIRECTORY returns TRUE if a connection was
  949.                 made.
  950.  
  951.  
  952.     DIRNAME(string)
  953.         Returns: STRING
  954.         Notes:  The parameter is either a "tag" to search for in
  955.                 the currently loaded dialing directory, "#nnn" where "nnn"
  956.                 is an entry's position in the directory, or it may be
  957.                 "" in which case it refers to the most recently dialed
  958.                 entry.  Returns the value of the "Name" field in the
  959.                 specified entry or "" if it could not be located.
  960.  
  961.     DIRPHONE(string)
  962.         Returns: STRING
  963.         Notes:  The parameter is either a "tag" to search for in
  964.                 the currently loaded dialing directory, "#nnn" where "nnn"
  965.                 is an entry's position in the directory, or it may be
  966.                 "" in which case it refers to the most recently dialed
  967.                 entry.  Returns the value of the "Number" field in the
  968.                 specified entry or "" if it could not be located.
  969.  
  970.     DIRSCRIPT(string)
  971.         Returns: STRING
  972.         Notes:  The parameter is either a "tag" to search for in
  973.                 the currently loaded dialing directory, "#nnn" where "nnn"
  974.                 is an entry's position in the directory, or it may be
  975.                 "" in which case it refers to the most recently dialed
  976.                 entry.  Returns the value of the "Script" field in the
  977.                 specified entry or "" if it could not be located.
  978.  
  979.     DIRTAG(string)
  980.         Returns: STRING
  981.         Notes:  The parameter is either a "tag" to search for in
  982.                 the currently loaded dialing directory, "#nnn" where "nnn"
  983.                 is an entry's position in the directory, or it may be
  984.                 "" in which case it refers to the most recently dialed
  985.                 entry.  Returns the value of the "Tag" field in the
  986.                 specified entry or "" if it could not be located.
  987.  
  988.     DOWNLOAD(special, string)
  989.         Returns: INTEGER, TRUE or FALSE
  990.         Notes:  The "special" parameter must be one of the following
  991.                 pre-defined constants: XMODEM, XMODEM1K, YMODEM,
  992.                 YMODEMG, ZMODEM, or QUERY.  If this parameter is
  993.                 QUERY, the user is prompted for the protocol.  The
  994.                 second parameter is the file name, if it is the empty
  995.                 string, XMODEM and XMODEM1K will prompt the user for
  996.                 the filename, this parameter is ignored by YMODEM,
  997.                 YMODEMG, and ZMODEM.
  998.                 The function returns TRUE if the file transfer ended
  999.                 with no fatal errors.  (See UPLOAD)
  1000.  
  1001.  
  1002.     DRAWBOX(integer, integer, integer, integer, integer, integer, integer)
  1003.         Returns: INTEGER, TRUE (success) or FALSE (error)
  1004.         Notes:  The parameters are, in order:
  1005.                   Row       - 1 to ScreenLines
  1006.                   Col       - 1 to ScreenCols
  1007.                   NumRows   - 1 to ScreenLines
  1008.                   NumCols   - 1 to ScreenCols
  1009.                   Attribute - 0 to 255, any valid color attribute
  1010.                   Style     - 0:No frame, 1:single lines, 2:double lines
  1011.                   Fill      - TRUE or FALSE
  1012.  
  1013.     DUMPINIT(void)
  1014.         Returns: INTEGER, always TRUE
  1015.         Notes:  Prints the current value of all the system-global
  1016.                 values settable via TE2.INI to the terminal screen.
  1017.  
  1018.  
  1019.     EMULATE(special)
  1020.         Returns: INTEGER, the new emulation.
  1021.         Notes:  The "special" parameter must be one of the following
  1022.                 pre-defined constants: TTY, ANSI_BBS, ANSI_TE2,
  1023.                 VT100, or QUERY.  If it is QUERY, the user is
  1024.                 prompted for the emulation.
  1025.  
  1026.  
  1027.     ERASE(string)
  1028.         Returns: INTEGER, 0 on success, -1 on error
  1029.         Notes:  This function will delete the indicated file from
  1030.                 the disk.  Clearly, you should use this function
  1031.                 with care.
  1032.  
  1033.     ERRORMSG(string, string)
  1034.         Returns: INTEGER, always TRUE
  1035.         Notes:  Displays the error message dialog (TE/2 uses this
  1036.                 dialog for most all, non-script related errors).
  1037.                 String1 is left justified on the first line of the
  1038.                 dialog, string2 centered on the second and "Strike
  1039.                 any key to continue" is placed at the bottom of the
  1040.                 dialog.  ErrorAttr from the initialization file is
  1041.                 used for the dialog color.  The portion of the screen
  1042.                 overlaid by the dialog is saved and restored when the
  1043.                 dialog is exited.
  1044.  
  1045.  
  1046.     EXECPGM(string, string, string, integer, integer)
  1047.         Returns: INTEGER
  1048.         Notes:  The arguments are, in order, session_title, program_name,
  1049.                 program_args, exec_type, and exec_flags.  These parameters
  1050.                 map directly to the information contained in the external
  1051.                 program file that TE/2 uses to build the "User Programs"
  1052.                 menu (Alt-J), you should refer to the TE/2 Manual for
  1053.                 more information on these settings.  All of the functionality
  1054.                 for user input and global value passing that is referred
  1055.                 to there is present here.  The exec_flags parameter is NOT
  1056.                 optional for this call like it is in the external programs
  1057.                 file however.
  1058.                 The return value of EXECPGM() depends on the mode in which
  1059.                 the child process was executed.  A return value of -1 will
  1060.                 usually indicate an invalid parameter list.  If the child
  1061.                 was executed in the background or in a new session, the
  1062.                 return value is zero for success or the error code which
  1063.                 was returned by OS/2.  If the child was executed as a
  1064.                 foreground process, the return value is the exit code of
  1065.                 the child program (i.e., the value which it passed to
  1066.                 DosExit()).
  1067.  
  1068.  
  1069.     EXIT(special)
  1070.         Returns: INTEGER, TRUE or FALSE
  1071.         Notes:  The "special" parameter must be one of the following
  1072.                 pre-defined constants: TRUE, FALSE, IFCARRIER.  If it
  1073.                 is FALSE, the user will be asked for confirmation
  1074.                 before exiting, if TRUE TE/2 will unconditionally
  1075.                 exit, if QUERY the user will be queried only if the
  1076.                 carrier is high (TE/2 is online).
  1077.                 The function returns TRUE if TE/2 is exiting
  1078.                 (although you won't be able to test this, if the
  1079.                 function returns to the script at all it should do so
  1080.                 with FALSE).
  1081.  
  1082.  
  1083.     FNKEY(integer)
  1084.         Returns: INTEGER, TRUE or FALSE
  1085.         Notes:  If the argument is zero or greater than 48, the
  1086.                 function key menu is activated, this is equivalent
  1087.                 to typing Alt-K from terminal mode.  If it is a
  1088.                 number from 1 to 48, the corresponding function key
  1089.                 macro is transmitted.
  1090.                         1 - 12  -> unshifed function keys 1-12
  1091.                        13 - 24  -> shifted function keys 1-12
  1092.                        25 - 36  -> control-function keys 1-12
  1093.                        37 - 48  -> alt-function keys 1-12
  1094.                 The function returns TRUE if a macro was transmitted.
  1095.  
  1096.  
  1097.     FCLOSE(integer)
  1098.         Returns:  INTEGER, TRUE or FALSE
  1099.         Notes:  The argument should be the value returned from an
  1100.                 earlier call to FOPEN (see notes on file handling).
  1101.                 This function returns TRUE if the file was
  1102.                 successfully closed.
  1103.  
  1104.  
  1105.     FEOF(integer)
  1106.         Returns:  INTEGER, TRUE or FALSE
  1107.         Notes:  The argument should be the value returned from an
  1108.                 earlier call to FOPEN (see notes on file handling).
  1109.                 This function returns TRUE if the current file
  1110.                 pointer position is at the end of file.
  1111.  
  1112.  
  1113.     FERROR(integer)
  1114.         Returns:  INTEGER, error code
  1115.         Notes:  The argument should be the value returned from an
  1116.                 earlier call to FOPEN (see notes on file handling).
  1117.                 This function returns FALSE if no error has occurred
  1118.                 accessing the indicated file, else it is an error
  1119.                 code.
  1120.  
  1121.  
  1122.     FGETC(integer)
  1123.         Returns:  INTEGER, character code or -1
  1124.         Notes:  The argument should be the value returned from an
  1125.                 earlier call to FOPEN (see notes on file handling).
  1126.                 This function returns the next character in a file
  1127.                 which has been opened for input.  A -1 result is
  1128.                 used to indicate end-of-file or error (See FEOF and
  1129.                 FERROR).
  1130.  
  1131.  
  1132.     FGETS(integer)
  1133.         Returns:  STRING, input from file
  1134.         Notes:  The argument should be the value returned from an
  1135.                 earlier call to FOPEN (see notes on file handling).
  1136.                 This function reads a line of text from a file opened
  1137.                 for input.  It reads all characters up to and
  1138.                 including a newline character ("^J", see notes on
  1139.                 file handling for information about newline
  1140.                 translation) or 1024 characters, whichever occurs
  1141.                 first. It returns and empty string to indicate
  1142.                 end-of-file or error (See FEOF and FERROR).
  1143.  
  1144.  
  1145.     FOPEN(string, string)
  1146.         Returns: INTEGER, file handle
  1147.         Notes:  This function MAY NOT be called outside the context
  1148.                 of and assignment statement.  It opens a file and
  1149.                 its return value is a "handle" for all the other
  1150.                 file oriented functions (FGETC, FEOF, FCLOSE, etc).
  1151.                 Care should be taken with this value so that it not
  1152.                 altered in any way until FCLOSE has safely been
  1153.                 called.
  1154.                 The first argument is a file name, the second is the
  1155.                 open "mode" and should be one of "r", "w", "a", "rt",
  1156.                 "rb", "wt", "wb", "at", "ab", "r+t", "w+t", "a+t",
  1157.                 "r+b", "w+b", or "a+b" (see notes on file handling
  1158.                 for an explanation).
  1159.                 If the function returns 0, the file was not opened.
  1160.  
  1161.  
  1162.     FPUTC(integer, integer)
  1163.         Returns:  INTEGER, the output character or -1
  1164.         Notes:  The second argument should be the value returned from
  1165.                 an earlier call to FOPEN (see notes on file handling).
  1166.                 The first argument is the ascii value of the
  1167.                 character to be output to the file, the file must
  1168.                 have been opened in a mode which allows writing of
  1169.                 data ("w", "a", etc).  A return value of -1 indicates
  1170.                 an error situation (see FEOF and FERROR).
  1171.  
  1172.  
  1173.     FPUTS(string, integer)
  1174.         Returns:  INTEGER, the last output character or -1
  1175.         Notes:  The second argument should be the value returned from
  1176.                 an earlier call to FOPEN (see notes on file handling).
  1177.                 The first argument is the string to write to the file.
  1178.                 The file must have been opened in a mode which allows
  1179.                 writing of data ("w", "a", etc).  A return value of
  1180.                 -1 indicates an error (see FEOF and FERROR).
  1181.  
  1182.  
  1183.     FSEEK(integer, integer, special)
  1184.         Returns:  INTEGER, TRUE or FALSE
  1185.         Notes:  The first argument should be the value returned from
  1186.                 an earlier call to FOPEN (see notes on file handling).
  1187.                 The second integer specifies an offset into the file
  1188.                 which may be positive, negative, or zero depending
  1189.                 upon the mode specified in the third argument.
  1190.                 This function will attempt to move the current file
  1191.                 location pointer in the indicated file to a number
  1192.                 of bytes (specified in the second argument) from the
  1193.                 origin (specified in the third argument).  The third
  1194.                 argument MUST be one of:
  1195.                         0 -- beginning of file
  1196.                         1 -- current position in file
  1197.                         2 -- end of file
  1198.                 If this function returns false, an error has occurred.
  1199.                 (see FEOF and FERROR)
  1200.  
  1201.  
  1202.     FTELL(integer)
  1203.         Returns:  INTEGER, 
  1204.         Notes:  The argument should be the value returned from an
  1205.                 earlier call to FOPEN (see notes on file handling).
  1206.                 This function retrieves the current location pointer
  1207.                 in the indicated file.  A return value of -1
  1208.                 indicates an error (see FOEF and FERROR).
  1209.  
  1210.  
  1211.     GETASCIIUP(string)
  1212.         Returns: INTEGER
  1213.         Notes: The valid values for the string parameter are identical
  1214.                to those required for SETASCIIUL(); see the table of
  1215.                values there.  GETASCIIUL() returns the current value
  1216.                of the requested setting.
  1217.  
  1218.     GETC(void)
  1219.         Returns: INTEGER, keystroke value or zero
  1220.         Notes:  Waits for the user to type a key and returns the value
  1221.                 of the keystroke.  If an error occurred, the return
  1222.                 is zero, if it was a 'standard' key, the return is
  1223.                 the ASCII value of the keystroke, if it was an
  1224.                 'extended' key (i.e., Alt key or function key) it
  1225.                 returns the scan code of the key times 256.  The
  1226.                 keystroke is NOT echoed to the terminal screen.
  1227.                 (See GETS)
  1228.  
  1229.  
  1230.     GETENV(string)
  1231.         Returns: STRING
  1232.         Notes:  This function will scan the OS/2 environment table
  1233.                 for the current process (TE/2) and retrieve the value
  1234.                 associated with the string specified in its argument
  1235.                 or the empty string if the argument was not found in
  1236.                 the environment.
  1237.         Examples:
  1238.                 CmdExe = GETENV("COMSPEC")
  1239.                 MESSAGE("%s", GETENV("PROMPT"))
  1240.  
  1241.  
  1242.     GETYESNO(string, string, integer)
  1243.         Returns: INTEGER, User selection result
  1244.         Notes:  Displays the Yes/No dialog (TE/2 uses this dialog
  1245.                 for querying the user for hangup and exit).  Both
  1246.                 strings are centered in the dialog, string2 may be
  1247.                 NULL.  The integer determines the default answer
  1248.                 (TRUE for Yes, FALSE for No). DLogNormAttr and
  1249.                 DLogHiAttr from the initialization file are used for
  1250.                 the dialog colors. The portion of the screen overlaid
  1251.                 by the dialog are saved and restored when the dialog
  1252.                 is exited.
  1253.                 Returns TRUE if "Yes" was selected, FALSE if "No" was
  1254.                 selected.
  1255.  
  1256.  
  1257.     GETS(integer)
  1258.         Returns: STRING
  1259.         Notes:  Gets a string from the console at the current cursor
  1260.                 location.  The argument specifies the maximum length
  1261.                 of the string, it may be a number from 1 to 255.  If
  1262.                 it is less than one, an empty string is immediately
  1263.                 returned, if it is greater than 255, it is treated as
  1264.                 if it were 255.  GETS retrieves a string from the
  1265.                 user up to, but not including the first carriage
  1266.                 return character or the maximum length whichever
  1267.                 occurs first.  Backspace will erase the previous
  1268.                 character typed (if any) and the ESCape key will
  1269.                 immediately terminate the input and GETS will return
  1270.                 an empty string.  If terminal display is turned on
  1271.                 (see TERMECHO) the input is echoed to the terminal
  1272.                 screen in the current attribute and at the current
  1273.                 cursor location.  (See GETC)
  1274.  
  1275.  
  1276.     HANGUP(special)
  1277.         Returns: INTEGER, TRUE or FALSE
  1278.         Notes:  The "special" argument must be one of TRUE, FALSE, or
  1279.                 IFCARRIER.  If FALSE, the hangup sequence will be
  1280.                 unconditionally performed, if TRUE the user will be
  1281.                 queried for permission, if IFCARRIER, the user will
  1282.                 be queried only if the carrier is high (TE/2 is
  1283.                 online).  The function returns TRUE if the hangup
  1284.                 sequence was successfully transmitted and TE/2 is
  1285.                 no longer on line.
  1286.                 NOTE: The parameter for the HANGUP() statement will
  1287.                   override the current setting of the TE/2 QueryHangUp
  1288.                   initialization variable.
  1289.  
  1290.  
  1291.     INTERPRET(string)
  1292.         Returns: INTEGER, always TRUE
  1293.         Notes:  Invokes the script parser on its argument and executes it
  1294.                 as a script command.  Anything that can be typed at the
  1295.                 "Command:" prompt can be executed via Interpret().
  1296.         Examples:
  1297.                 INTERPRET("hangup(false)")
  1298.                 INTERPRET("downloadpath = ""d:\foo""")
  1299.  
  1300.  
  1301.     ITOA(integer, special)
  1302.         Returns: STRING, ASCII representation of the argument
  1303.         Notes:  The "special" argument must be in the range 2-36,
  1304.                 it specifies the radix for the conversion (number
  1305.                 system base.  If the radix is 10 and the value of
  1306.                 the first argument is negative, a leading '-' sign
  1307.                 is the first character of the result.
  1308.         Examples:
  1309.                 ITOA(1234, 10) returns "1234"
  1310.                 ITOA(8, 2)     returns "1000"
  1311.  
  1312.  
  1313.     JDATE(integer, integer)
  1314.         Returns:  INTEGER, A packed date (in the same format as the
  1315.                   'date' read-only variable) based on the given Julian
  1316.                   day number in the first parameter. Returns 0 on error.
  1317.         Notes:  The first parameter is the Julian Day Number to
  1318.                 translate, the second is a Boolean switch.  If the
  1319.                 second parameter is TRUE, the returned date will be
  1320.                 relative to the Gregorian Calendar otherwise it will
  1321.                 be relative to the Julian Calendar.  If the Julian
  1322.                 Day Number is invalid or the results would be out of
  1323.                 bounds for the requested calendar, the return value
  1324.                 will be 0. (See discussion on Julian date conversions
  1325.                 elsewhere in this document.)
  1326.  
  1327.  
  1328.     JULIAN(integer, integer)
  1329.         Returns:  INTEGER, Julian Day Number or -1 on error.
  1330.         Notes:  The first parameter must be a packed date in the same
  1331.                 format as the 'date' read-only variable.  The second
  1332.                 parameter indicates which calendar to use when
  1333.                 translating the date: TRUE means that this is a
  1334.                 Gregorian date, FALSE implies a Julian date.  The
  1335.                 return value is the Julian Day Number for the given
  1336.                 date.  If the date is invalid for the indicated
  1337.                 calendar, this function returns -1. (See discussion
  1338.                 on Julian date conversions elsewhere in this
  1339.                 document.)
  1340.  
  1341.  
  1342.     JULIAN2(integer, integer, integer, integer)
  1343.         Returns:  INTEGER, Julian Day Number or -1 on error.
  1344.         Notes:  The parameters are, in order: month number (1 to 12),
  1345.                 day number (1 to 31), year number, and a Boolean to
  1346.                 indicate which calendar to use when translating this
  1347.                 date: TRUE means that this is a Gregorian date, FALSE
  1348.                 inplies a Julian Date.  The return value is the Julian
  1349.                 Day Number for the given date.  If the date is invalid
  1350.                 for the indicated calendar, this function returns -1.
  1351.                 (See discussion on Julian date conversions elsewhere in
  1352.                 this document.)
  1353.  
  1354.  
  1355.     JWDAY(integer)
  1356.         Returns: INTEGER, weekday index (0 to 6) or -1 on error.
  1357.         Notes:  The single parameter is a Julian Day Number, the
  1358.                 function will return the weekday index for that
  1359.                 Julian Day (0 is Sunday).  If the Julian Day number
  1360.                 is invalid, the function returns -1.
  1361.  
  1362.  
  1363.     LFAFTERCR(special)
  1364.         Returns: INTEGER, TRUE or FALSE, the new value of LFafterCR
  1365.         Notes:  The "special" parameter must be one of TRUE, FALSE,
  1366.                 or TOGGLE.  If TRUE or FALSE, the value of the
  1367.                 LF-After-CR flag is set to that value, if it is
  1368.                 TOGGLE the flag becomes TRUE if it was FALSE and
  1369.                 vice-versa.
  1370.  
  1371.  
  1372.     LOCALECHO(special)
  1373.         Returns: INTEGER, TRUE or FALSE, the new value of LocalEcho
  1374.         Notes:  The "special" parameter must be one of TRUE, FALSE,
  1375.                 or TOGGLE.  If TRUE or FALSE, the value of the
  1376.                 Local-Echo flag is set to that value, if it is
  1377.                 TOGGLE the flag becomes TRUE if it was FALSE and
  1378.                 vice-versa.
  1379.  
  1380.  
  1381.     LOGCLOSE(void)
  1382.         Returns: INTEGER, TRUE or FALSE
  1383.         Notes:  Closes the currently open log file and returns TRUE,
  1384.                 if there is no currently open log file no action is
  1385.                 performed and the function returns FALSE.
  1386.  
  1387.  
  1388.     LOGFILE(void)
  1389.         Returns: INTEGER, TRUE or FALSE
  1390.         Notes:  This is equivalent to typing Alt-L in terminal mode.
  1391.                 If a log file is currently open this function will
  1392.                 close it and return TRUE, else the user will be
  1393.                 prompted for a log file name to open.  In this case
  1394.                 it returns TRUE if a log file was opened or FALSE if
  1395.                 the user typed ESCape at the prompt of if there was
  1396.                 an error opening the file.
  1397.  
  1398.  
  1399.     LOGOPEN(string, integer)
  1400.         Returns: INTEGER, TRUE or FALSE
  1401.         Notes:  The first argument specifies the log file to open.
  1402.                 This must contain the entire path/name of the file,
  1403.                 default logpath handling is NOT performed on this
  1404.                 string.  The second argument should be TRUE if the
  1405.                 the log file should overwrite any existing file of
  1406.                 the same name, if FALSE, new data will be appended
  1407.                 to the file.
  1408.                 If the first argument is NULL, the user will be
  1409.                 prompted for the file name and overwrite/append mode,
  1410.                 the second parameter is ignored.
  1411.                 The function returns TRUE is a log file was
  1412.                 successfully opened, FALSE if the file was not opened
  1413.                 due to error or user intervention.
  1414.  
  1415.  
  1416.     LOGPAUSE(special)
  1417.         Returns: INTEGER, TRUE or FALSE
  1418.         Notes:  The "special" argument must be one of TRUE, FALSE, or
  1419.                 TOGGLE.  If TRUE, the log file will be placed in the
  1420.                 paused state, if FALSE it will be made active, if
  1421.                 TOGGLE it will alternate states.  The function
  1422.                 returns TRUE if an action was performed, if there is
  1423.                 no currently open log file, it will return FALSE.
  1424.  
  1425.  
  1426.     MAINMENU(special)
  1427.         Returns: INTEGER, TRUE or FALSE
  1428.         Notes:  The "special" argument must be one of -1, 0, 1, or 2
  1429.                 with the following meanings:
  1430.                    -1 -> Cycle menu state
  1431.                     0 -> Turn OFF Menu or Status bar
  1432.                     1 -> Turn ON Menu
  1433.                     2 -> TURN ON Status bar
  1434.                 The function returns TRUE if the menu state was changed.
  1435.                 Note that the system-global variable "MenuActive" may be
  1436.                 examined to determine the current state of the menu.
  1437.  
  1438.  
  1439.     MESSAGE(string, ... )
  1440.         Returns: INTEGER, the length of the message string
  1441.         Notes:  MESSAGE takes a parameter list identical to the
  1442.                 SPRINTF function, refer to SPRINTF for a more
  1443.                 complete discussion of the format string and its
  1444.                 arguments.  This function will build a string
  1445.                 according to the rules for SPRINTF and display it
  1446.                 on the terminal screen at the current cursor
  1447.                 location.
  1448.  
  1449.  
  1450.     MUXWAIT(string, integer)
  1451.         Returns: INTEGER
  1452.         Notes:  Very much like the related WAITFOR function, MUXWAIT
  1453.                 allows you to specify, in the its first argument, as
  1454.                 many as 10 strings to wait for.  The first character
  1455.                 of the string argument defines the delimiter that
  1456.                 will be in effect for parsing the seperate wait
  1457.                 strings.  This may be any character you choose bit it
  1458.                 should be a character that does not otherwise appear
  1459.                 in any of the substrings (see the examples). MUXWAIT
  1460.                 does not return until one of the specified strings
  1461.                 has been encountered at the comm port, the duration
  1462.                 in seconds specified in the second argument has
  1463.                 elapsed, or the user types ESCape, whichever occurs
  1464.                 first.  Returns the index of the string which was
  1465.                 found or FALSE if a timeout occured or the wait was
  1466.                 aborted by typing ESCape.
  1467.                 Incoming characters are echoed to the terminal screen
  1468.                 unless terminal display is turned off, the log file
  1469.                 is maintained.  (See WAITFOR, WATCHFOR)
  1470.                 If the second parameter is less than zero, normal
  1471.                 timeout processing is disabled and MUXWAIT will not
  1472.                 return until a string has been matched or an ESCape
  1473.                 is typed at the keyboard.
  1474.         Examples:
  1475.                 MUXWAIT("/ENTER to continue/Select:/", 60)
  1476.                         The above example will wait up to 60 seconds
  1477.                         for either the string "ENTER to continue" or
  1478.                         "Select:" to appear at the comm port.  If,
  1479.                         for instance, "Select:" was encountered, the
  1480.                         function returns 2.
  1481.                 MUXWAIT("!Enter name/userid:!What system?!", 30)
  1482.                         Note the use of "!" as the delimiter in this
  1483.                         example rather than the "/" used in the
  1484.                         first.  This example needs to use the slash
  1485.                         as a valid character in one of its searches
  1486.                         thus the different delimiter is mandated.
  1487.  
  1488.  
  1489.     OPENDIALOG(integer, integer, integer, integer, integer)
  1490.         Returns: INTEGER, handle to created dialog
  1491.         Notes:  Creates a dialog box on screen complete with frame
  1492.                 and shadow.  The arguments are, in order, top row,
  1493.                 left column, bottom row, right column, and color
  1494.                 attribute.  The contents of the portion of the screen
  1495.                 overlaid by the dialog box are saved and will be
  1496.                 restored with a subsequent call to CLOSEDIALOG.
  1497.                 The return value is a 'handle' to the dialog.
  1498.  
  1499.  
  1500.     PARMSMNU(void)
  1501.         Returns: INTEGER, always FALSE
  1502.         Notes:  This is equivalent to typing Alt-P from terminal
  1503.                 mode.  The system-global variables "Device", "Port",
  1504.                 "Baud", "WordLen", and "StopBits" may be examined
  1505.                 to determine the current line settings at any time.
  1506.  
  1507.  
  1508.     PASSWORD(string)
  1509.         Returns: STRING
  1510.         Notes:  The parameter is either a "tag" to search for in
  1511.                 the currently loaded dialing directory, "#nnn" where "nnn"
  1512.                 is an entry's position in the directory, or it may be
  1513.                 "" in which case it refers to the most recently dialed
  1514.                 entry.  Returns the value of the "Password" field in the
  1515.                 specified entry or "" if it could not be located.
  1516.  
  1517.     PGMMENU(void)
  1518.         Returns: INTEGER, always TRUE
  1519.         Notes:  This is equivalent to typing Alt-J in terminal mode.
  1520.  
  1521.  
  1522.     PLAYFILE(string, integer)
  1523.         Returns: INTEGER, 0 if no error or an error value
  1524.         Notes: The string parameter should be the name of an MMOS2
  1525.                "playable" file (.WAV, .VOC, etc).  The integer parameter
  1526.                should be set to TRUE is you wish the PLAYFILE function
  1527.                to wait until MMOS2 is finished playing the file before
  1528.                returning or FALSE if you wish asychronous play.  In
  1529.                asychronous mode, PLAYFILE always returns 0.  This function
  1530.                is only valid if MMOS2 is installed on the system.
  1531.                (See RECORDFILE)
  1532.  
  1533.  
  1534.     POPKEYBOARD(void)
  1535.         Returns: INTEGER, TRUE or FALSE
  1536.         Notes: "Pops" a keyboard definition that was previously "pushed"
  1537.                via PUSHKEYBOARD() and makes it the current keyboard.  The
  1538.                old current keyboard is discarded.  Returns TRUE if
  1539.                successful, FALSE if the stack was empty.  (See PUSHKEYBOARD,
  1540.                READKEYFILE, QUERYKEYFILE)
  1541.  
  1542.  
  1543.     PUSHKEYBOARD(void)
  1544.         Returns: INTEGER, TRUE or FALSE
  1545.         Notes: "Pushes", or saves, the current keyboard definition on
  1546.                an internal stack for later retrieval via POPKEYBOARD().
  1547.                The current keyboard definition is then set to all
  1548.                default keystroke values.  Returns TRUE if successful or
  1549.                FALSE if an error occured.  (See POPKEYBOARD, READKEYFILE,
  1550.                QUERYKEYFILE)
  1551.  
  1552.  
  1553.     QUERYKEYFILE(void)
  1554.         Returns: STRING
  1555.         Notes: Returns the name of the currently loaded key mapping file
  1556.                (loaded via "KeyMapFile" in TE2.INI or the READKEYFILE()
  1557.                function) or the empty string if the default keyboard is
  1558.                in effect.  (See POPKEYBOARD, PUSHKEYBOARD, READKEYFILE)
  1559.  
  1560.  
  1561.     QUEUEDIAL(void)
  1562.         Returns: INTEGER, TRUE or FALSE
  1563.         Notes:  This is equivalent to typing Alt-Q in terminal mode
  1564.                 or "Q" in the dialing directory in that it activates
  1565.                 the Queue Dialer.  The function returns TRUE if a
  1566.                 connection resulted.
  1567.  
  1568.  
  1569.     RESTART(integer)
  1570.         Returns: INTEGER, TRUE or FALSE
  1571.         Notes: Closes and reopens the current "Device".  If the integer
  1572.                parameter is set to TRUE, the user will be prompted for
  1573.                action after the device has been closed and before it is
  1574.                reopened.  The user may elect to exit TE/2 at this point.
  1575.                If set to FALSE, ReStart() procedes directly to the reopen
  1576.                phase without prompting the user.  This function is not
  1577.                available if TE/2 was started with a "hot" handle.  If
  1578.                Restart() fails to reopen the device, usually TE/2 will
  1579.                be exited.  If Telnet handshaking is enabled, it will be
  1580.                reinitialized.  Returns TRUE on success and FALSE on
  1581.                failure (if it returns from failure at all).
  1582.  
  1583.  
  1584.     READKEYFILE(string)
  1585.         Returns: INTEGER, TRUE or FALSE
  1586.         Notes: The string parameter names a TE/2 Keyboard Definition File
  1587.                presumably created via the TE2Kbd utility.  This function
  1588.                reads the keyboard definition in the file into the current
  1589.                TE/2 keyboard definition, overwriting the current definitions.
  1590.                Returns TRUE on success, FALSE on FAILURE.  (See POPKEYBOARD,
  1591.                PUSHKEYBOARD, QUERYKEYFILE)
  1592.  
  1593.  
  1594.     READSCR(integer, integer, integer)
  1595.         Returns: STRING
  1596.         Notes:  The parameters are screen row, screen column, and number
  1597.                 of bytes to read respecitvely.  Function returns a string
  1598.                 containing the screen contents from the specified
  1599.                 co-ordinates.
  1600.  
  1601.     RECORDFILE(string, string)
  1602.         Returns: INTEGER, 0 on success or an error value
  1603.         Notes: The first string parameter is the name of an output file
  1604.                which will be created by MMOS2, the second string
  1605.                parameter will the the title bar text for the recorder
  1606.                window.  This function is only available if you have
  1607.                MMOS2 installed on your system and may only be called if
  1608.                TE/2 is running "in a window".  Furthermore, you should
  1609.                have a microphone installed with your multimedia hardware
  1610.                to successfully use this function.
  1611.  
  1612.  
  1613.     REDIAL(void)
  1614.         Returns: INTEGER, TRUE or FALSE
  1615.         Notes:  This is equivalent to typing Alt-R in terminal mode in
  1616.                 that the Redialer is activated.  The function returns
  1617.                 TRUE is a connection resulted.
  1618.  
  1619.  
  1620.     RENAME(string, string)
  1621.         Returns: INTEGER, TRUE or FALSE
  1622.         Notes:  This function will attempt to rename the file
  1623.                 specified in the first argument to the new name given
  1624.                 in the second argument.  The function returns TRUE if
  1625.                 it was successful, otherwise an error has occurred.
  1626.                 Further note, this function may be used to move a
  1627.                 file from one subdirectory to another on the same
  1628.                 disk but not across disks.
  1629.         Examples:
  1630.                 RENAME("logfile.log", "logfile.bak")
  1631.                 RENAME("somefile.dat", "\safe\place\somefile.dat")
  1632.  
  1633.  
  1634.     RESTORESCR(integer)
  1635.         Returns: INTEGER, always TRUE
  1636.         Notes:  The argument MUST be a handle to a saved screen that
  1637.                 has been created via an earlier call to SAVESCR or
  1638.                 disaster is sure to follow.  This function will restore
  1639.                 a previously saved screen setup, restoring the video
  1640.                 mode (if neccessary), cursor position, size, and
  1641.                 attribute, and the entire contents of the screen and
  1642.                 frees up all memory used by SAVESCR.
  1643.  
  1644.  
  1645.     RGETC(integer, special)
  1646.         Returns: INTEGER, received character or 0
  1647.         Notes:  This function retrieves one byte of incoming data.
  1648.                 The integer parameter specifies the timeout value in
  1649.                 seconds.  If the timeout period elapses or the user
  1650.                 types an ESCape at the console before a byte of
  1651.                 information is received, RGETC returns 0.
  1652.                 The second, special parameter determines how TE/2 will
  1653.                 echo the character back to the sender.  It may be an
  1654.                 integer or a string.  If it is an integer and is non-zero
  1655.                 then the character will be echoed back to the sender,
  1656.                 if it is zero, or if it is an empty or NULL string,
  1657.                 no character is echoed.  Otherwise, the first character
  1658.                 of the string is echoed back to the sender (use this
  1659.                 for remote entry of passwords, for instance).
  1660.                 Note that by specifying a number less than zero as the
  1661.                 timeout parameter, timeout processing is disabled.
  1662.                 Incoming characters are echoed to the terminal screen
  1663.                 unless terminal display is turned off, the log file
  1664.                 is maintained.
  1665.                 Backspaces are processed and filtered by RGETS before
  1666.                 returning, if echoing is enabled, backspaces,
  1667.                 carriage returns, and line feeds are echoed as
  1668.                 themselves regardless of any translation specified
  1669.                 in parameter 2. (See RGETS)
  1670.  
  1671.  
  1672.     RGETS(integer, integer, special)
  1673.         Returns: STRING, the received data
  1674.         Notes:  This function retrieves incoming data into a string
  1675.                 variable up to the first carriage return or the
  1676.                 string length specified in the first argument or
  1677.                 until the number of seconds specified in the second
  1678.                 argument has elapsed, or until the user types an
  1679.                 ESCape character at the console, whichever occurs first. 
  1680.                 The third, special parameter determines how TE/2 will
  1681.                 echo the characters back to the sender.  It may be an
  1682.                 integer or a string.  If it is an integer and is non-zero
  1683.                 then the characters will be echoed back to the sender,
  1684.                 if it is zero, or if it is an empty or NULL string,
  1685.                 no characters are echoed.  Otherwise, the first character
  1686.                 of the string is echoed back to the sender for each
  1687.                 received character. (use this for remote entry of
  1688.                 passwords, for instance).
  1689.                 Note that by specifying a number less than zero as the
  1690.                 timeout parameter, timeout processing is disabled.
  1691.                 Incoming characters are echoed to the terminal screen
  1692.                 unless terminal display is turned off, the log file
  1693.                 is maintained.
  1694.                 Backspaces are processed and filtered by RGETS before
  1695.                 returning, if echoing is enabled, backspaces,
  1696.                 carriage returns, and line feeds are echoed as
  1697.                 themselves regardless of any translation specified
  1698.                 in parameter 3.
  1699.                 If the length parameter evaluates to 1, backspaces
  1700.                 are NOT filtered or translated.
  1701.                 (See RGETC)
  1702.  
  1703.  
  1704.     RSHELL(string, string, integer)
  1705.         Returns: INTEGER
  1706.         Notes:  Similar in many ways to the SHELL function but subtly
  1707.                 different in several important aspects.  The first string
  1708.                 specifies a program to be executed, the second its arguments.
  1709.                 The program argument MUST be specified, there is no default
  1710.                 value.  When the program is executed, the standard input,
  1711.                 standard output, and standard error system handles are all
  1712.                 redirected to the comm port.  Thus, any program which takes
  1713.                 its input from stdin and writes to stdout and/or stderr,
  1714.                 will receive its input now from the comm port and send its
  1715.                 output back out the comm port.
  1716.                 If the third, integer parameter is non-zero TE/2 will
  1717.                 continue to monitor the status of the connection while the
  1718.                 child process is running.  If a loss of carrier is detected,
  1719.                 the child program will be aborted and control will return
  1720.                 to your script file.
  1721.                 TE/2's screen wil be saved and cleared before executing the
  1722.                 RSHELL program and restored upon return.
  1723.                 The return value is -1 if there was an error otherwise it is
  1724.                 the return code of the program.
  1725.                 RSHELL processes incoming backspace characters
  1726.                 in the expected fashion.
  1727.                 The meaning of the third parameter has been
  1728.                 expanded.  The parameter may take any of the
  1729.                 following values either singly or ORed together:
  1730.                       1 --> watch carrier
  1731.                       2 --> echo incoming characters
  1732.                       4 --> translate cr == cr-lf
  1733.                       8 --> buffer remote input & translate backspaces
  1734.                 Any other bits set in the parameter are ignored.
  1735.                 While in the RSHELL, the remote user has several
  1736.                 special key sequences available that will modify the
  1737.                 behavior.  Each begins with a Control-Backslash
  1738.                 (^\, ascii code 28):
  1739.                       ^\e --> toggles echoing of characters
  1740.                       ^\x --> toggles cr-crlf translation
  1741.                       ^\b --> toggles buffering
  1742.                 Anything else following a ^\ is simply passed
  1743.                 through unchanged (thus ^\^\ == ^\).  Note that the
  1744.                 character codes ARE case sensitive, that is, ^\B is
  1745.                 not the same thing as ^\b.  More special codes may
  1746.                 be added in the future.
  1747.  
  1748.  
  1749.     SAVEDIRFILE(string)
  1750.         Returns: INTEGER, 0 on success or an eror code
  1751.         Notes:  Saves the current dialing directory to disk using
  1752.                 the filename specified in the parameter.  If the
  1753.                 parameter is "" then the file will be saved using
  1754.                 its current name.
  1755.  
  1756.     SAVESCR(void)
  1757.         Returns: INTEGER, handle to saved screen information
  1758.         Notes:  Saves the current contents of the entire screen and
  1759.                 returns a 'handle' to the saved information.  This
  1760.                 information includes the current video mode, the
  1761.                 cursor position, the cursor size and attribute as
  1762.                 well as the actual contents of the screen. If SAVESCR
  1763.                 returns zero then there was not sufficient memory
  1764.                 to perform the operation.
  1765.  
  1766.  
  1767.     SCROLLBACK(void)
  1768.         Returns: INTEGER, TRUE or FALSE
  1769.         Notes:  This is equivalent to typing Alt-W from terminal
  1770.                 mode.  The function returns TRUE unless the Scroll
  1771.                 Back feature is disabled in which case it returns
  1772.                 FALSE.
  1773.  
  1774.  
  1775.     SETANSI8BIT(integer)
  1776.         Returns: INTEGER
  1777.         Notes: The integer parameter should be either TRUE or FALSE, this
  1778.                function sets or clears the "ANSI8Bit" flag.  Returns
  1779.                the previous value of the flag.
  1780.  
  1781.  
  1782.     SETANSIBS(integer)
  1783.         Returns: INTEGER
  1784.         Notes: The integer parameter should be either TRUE or FALSE, this
  1785.                function sets or clears the "ANSIBackspace" flag.  Returns
  1786.                the previous value of the flag.
  1787.  
  1788.     SETASCIIUL(string, integer)
  1789.         Returns: INTEGER
  1790.         Notes: Use this to set various ASCII Upload settings.  The string
  1791.                parameter defines what is expected in the integer parameter.
  1792.                Use the following table:
  1793.  
  1794.                  String is....  Integer should be...
  1795.                  -------------  --------------------
  1796.                  Prompt         ASCII value of prompt char or 0 if no prompt.
  1797.                  CRbeforeLF     0 or 1 (true or false)
  1798.                  Expand         0 or 1 (true or false)
  1799.                  Indent         0 or 1 (true or false)
  1800.                  View           0 or 1 (true or false)
  1801.                  SevenBit       0 or 1 (true or false)
  1802.                  CharPacing     pacing in milliseconds
  1803.                  LinePacing     pacing in milliseconds
  1804.                  CharTimeout    timeout in milliseconds
  1805.                  PromptTimeout  timeout in milliseconds
  1806.  
  1807.         Note further: "SetAsciiUL("Indent", value)" is equivalent to
  1808.                       "AsciiULIndent = value" and "SetAsciiUL("View", value)"
  1809.                       is equivalent to "LocalEcho = value" (this last has
  1810.                       other implications!  Be careful.)
  1811.  
  1812.  
  1813.     SETCTSRTS(integer)
  1814.         Returns: INTEGER, TRUE or FALSE
  1815.         Notes:  Sets the Cts/Rts handling according to the argument:
  1816.                         0  -  CTS/RTS both off
  1817.                         1  -  CTS on, RTS off
  1818.                         2  -  RTS on, CTS off
  1819.                         3  -  CTS/RTS both on
  1820.                 The function returns TRUE if it was successful.
  1821.  
  1822.  
  1823.     SETCURSOR(integer, integer)
  1824.         Returns: INTEGER, TRUE on success, FALSE on error
  1825.         Notes:  Places the cursor at (row, column) on the terminal
  1826.                 screen. This is direct placement independent of the
  1827.                 current terminal emulation.  The origin is (usually)
  1828.                 the upper lefthand corner and is (0,0).  If the current
  1829.                 terminal emulation is VT100 AND the virtual terminal is
  1830.                 in relative cursor addressing mode AND a scroll region
  1831.                 is set, this function will obey the VT100 emulation's
  1832.                 rules for cursor placement relative to scrolling region.
  1833.                 If the requested location is invalid, this function
  1834.                 will return FALSE.
  1835.  
  1836.     SETCURSORSZ(integer, integer)
  1837.         Returns: INTEGER, TRUE on success, FALSE on failure
  1838.         Notes:  Sets the size of the cursor, the parameters are the
  1839.                 top and bottom scan lines for the cursor.  If successful,
  1840.                 system global variables CursorTop and CursorBottom are
  1841.                 updated.
  1842.  
  1843.     SETFNKEYFILE(string)
  1844.         Returns: INTEGER, 0 on success, 1 on file not found, 2 on read error
  1845.         Notes: Loads a new function key definition file.  If the parameter
  1846.                is "" then the user will be queried for the file name.
  1847.  
  1848.     SETMARK(string, special)
  1849.         Returns: INTEGER
  1850.         Notes:  The string parameter is a dialing directory tag, "special"
  1851.                 is TRUE, FALSE, or TOGGLE. This function sets the mark for
  1852.                 the queue dialer on the specified dialing directory entry.
  1853.                 Returns the OLD state of the mark for that entry (TRUE or
  1854.                 FALSE) or -1 if "tag" was not found.
  1855.  
  1856.     SETNAME(string, string)
  1857.         Returns: INTEGET, TRUE or FALSE
  1858.         Notes: The first paramter is a "tag" to search the currently
  1859.                loaded dialing directory for; if it is "" then it is
  1860.                taken to mean the most recently dialed entry, if it is
  1861.                "#nnn" then it is the "nnn"th directory entry.  The
  1862.                "Name" field in that entry will be set to the value
  1863.                of the second parameter.  Return TRUE on success or
  1864.                FALSE on error.
  1865.  
  1866.     SETPARMS(integer, integer, integer, integer, integer)
  1867.         Returns: INTEGER, TRUE or FALSE
  1868.         Notes:  The arguments are Portnumber, baudrate, parity,
  1869.                 wordlength, and stopbits respectively.  SETPARMS
  1870.                 returns TRUE if it was able to set the specified
  1871.                 parameter configuration.  If it was unsuccessful
  1872.                 NONE of the parameters were changed.  If the port
  1873.                 number changes, the original comm port will be
  1874.                 closed and any active connection severed.  If any
  1875.                 of the parameters are to stay the same either the
  1876.                 appropriate system-global variable should be used
  1877.                 or, alternately a -1 in that position.
  1878.         Examples:
  1879.                 SETPARMS(Port, 2400, 0, 8, 0) sets the current
  1880.                   comm port to 2400 baud, no parity, 8 bit word
  1881.                   length and 1 stop bit.
  1882.                 SETPARMS(-1, 2400, 0, 8, 0) is equivalent to the
  1883.                   previous example.
  1884.                 SETPARMS(-1, 9600, -1, -1, -1) sets the current
  1885.                   comm port to 9600 baud and leaves all other
  1886.                   settings alone.
  1887.                 SETPARMS(Port, 9600, Parity, WordLen, StopBits)
  1888.                   is equivalent to the previous example.
  1889.         Further Notes:
  1890.                 The following is a list of the numbers to use for
  1891.                 setting parity, word length, and stop bits:
  1892.  
  1893.                 Parity:
  1894.                         0  -  no parity
  1895.                         1  -  odd parity
  1896.                         2  -  even parity
  1897.                         3  -  mark parity
  1898.                         4  -  space parity
  1899.  
  1900.                 Word Length:
  1901.                         7  -  7 bit words
  1902.                         8  -  8 bit words
  1903.  
  1904.                 Stop Bits:
  1905.                         0  -  1 stop bit
  1906.                         1  -  1.5 stop bits
  1907.                         2  -  2 stop bits
  1908.  
  1909.  
  1910.     SETPARMS2(string, integer, integer, integer, integer)
  1911.         Returns: INTEGER, TRUE or FALSE
  1912.         Notes: Exactly like SETPARMS() in all respects except that it
  1913.                takes a string argument for the device name instead of an
  1914.                integer 'port number' so it can be used to switch devices
  1915.                with the device name isn't COMx.  (See the SETPARMS for
  1916.                further information)
  1917.  
  1918.  
  1919.     SETPASSWORD(string, string)
  1920.         Returns: INTEGET, TRUE or FALSE
  1921.         Notes:  The first paramter is a "tag" to search the currently
  1922.                 loaded dialing directory for; if it is "" then it is
  1923.                 taken to mean the most recently dialed entry, if it is
  1924.                 "#nnn" then it will mean the "nnn"th entry.  The
  1925.                 "Password" field in that entry will be set to the value
  1926.                 of the second parameter.  Return TRUE on success or
  1927.                 FALSE on error.
  1928.  
  1929.     SETPHONE(string, string)
  1930.         Returns: INTEGET, TRUE or FALSE
  1931.         Notes:  The first paramter is a "tag" to search the currently
  1932.                 loaded dialing directory for; if it is "" then it is
  1933.                 taken to mean the most recently dialed entry, if it is
  1934.                 "#nnn" then it will mean the "nnn"th entry.  The
  1935.                 "Number" field in that entry will be set to the value
  1936.                 of the second parameter.  Return TRUE on success or
  1937.                 FALSE on error.
  1938.  
  1939.     SETSCRIPT(string, string)
  1940.         Returns: INTEGET, TRUE or FALSE
  1941.         Notes:  The first paramter is a "tag" to search the currently
  1942.                 loaded dialing directory for; if it is "" then it is
  1943.                 taken to mean the most recently dialed entry, if it is
  1944.                 "#nnn" then it will mean the "nnn"th entry.  The
  1945.                 "Script" field in that entry will be set to the value
  1946.                 of the second parameter.  Return TRUE on success or
  1947.                 FALSE on error.
  1948.  
  1949.     SETTAG(string, string)
  1950.         Returns: INTEGET, TRUE or FALSE
  1951.         Notes:  The first paramter is a "tag" to search the currently
  1952.                 loaded dialing directory for; if it is "" then it is
  1953.                 taken to mean the most recently dialed entry, if it is
  1954.                 "#nnn" then it will mean the "nnn"th entry.  The
  1955.                 "Tag" field in that entry will be set to the value
  1956.                 of the second parameter.  Return TRUE on success or
  1957.                 FALSE on error.
  1958.  
  1959.     SETXONXOFF(integer)
  1960.         Returns: INTEGER, TRUE or FALSE
  1961.         Notes:  If the argument is zero, XonXoff processing will be
  1962.                 turned off, if the argument is "1" transmit XonXoff
  1963.                 processing will be enabled, if it is "2" receive
  1964.                 XonXoff processing will be enabled, if it is "3" both
  1965.                 transmit and receive XonXoff processing are enabled.
  1966.                 The system-global variable "XonXoff" may be examined
  1967.                 at any time to determine the current state of XonXoff
  1968.                 processing.  The function returns TRUE if it was
  1969.                 successful.
  1970.  
  1971.  
  1972.     SETVT100BKSP(integer)
  1973.         Returns: INTEGER
  1974.         Notes:  Sets the VT100 emulation backspace translation mode.
  1975.                 If the parameter is TRUE then the VT100 eumlation
  1976.                 will treat incoming Backspace characters (ASCII 8)
  1977.                 as destructive backspaces, if FALSE the VT100 backspace
  1978.                 will be non-destructive.  Returns the previous setting
  1979.                 for the VT100 Backspace handling.
  1980.  
  1981.     SETXLATTABLE(string, integer)
  1982.         Returns: INTEGER
  1983.         Notes:  Reads a new character translation table from the
  1984.                 file specified in the first parameter.  If the second
  1985.                 parameter is zero, the new table will replace the
  1986.                 input character translation table, if it is non-zero,
  1987.                 it will replace the output character translation table.
  1988.                 Returns 0 on success or an error code on failure.
  1989.  
  1990.     SENDBREAK(integer)
  1991.         Returns: INTEGER, the value of its argument
  1992.         Notes:  Will transmit a break signal to the port for the
  1993.                 specified duration in milliseconds.  If a zero value
  1994.                 is specified, the current value of the system-global
  1995.                 variable "BreakLen" is used for the duration.
  1996.  
  1997.  
  1998.     SENDBYTE(integer OR string)
  1999.         Returns: INTEGER, TRUE or FALSE
  2000.         Notes:  Sends the byte specified by either the integer
  2001.                 expression or the first character of the string
  2002.                 expression to the port.  If the character is either
  2003.                 Ctrl-S or Ctrl-Q, the byte is transmitted
  2004.                 immediately.  The function returns TRUE if it was
  2005.                 successful.
  2006.  
  2007.  
  2008.     SENDINIT(void)
  2009.         Returns: INTEGER, TRUE or FALSE
  2010.         Notes:  Transmits the string in the system-global variable
  2011.                 "modemInitStrg" to the comm port.  Returns TRUE if
  2012.                 it was successful.
  2013.  
  2014.  
  2015.     SHELL(string, string)
  2016.         Returns: INTEGER
  2017.         Notes:  Executes the program specified in the first argument
  2018.                 sending it the parameters specified in the second.
  2019.                 If the first argument is NULL, the current value of
  2020.                 the system-global variable "ShellCmd" is used unless
  2021.                 it is also NULL in which case CMD.EXE is executed
  2022.                 with no parameters.  If the first argument is NULL,
  2023.                 the second argument is ignored.  The program is
  2024.                 executed synchronously in the foreground, TE/2 is
  2025.                 suspended while in the shell.  TE/2's screen is saved
  2026.                 before and restored after execution.  The return
  2027.                 value of the function is the return code of the
  2028.                 executed program or -1 if an error occurred.
  2029.                 SHELL(NULL, NULL) is equivalent to typing Alt-O from
  2030.                 terminal mode.
  2031.  
  2032.  
  2033.     SLEEP(integer)
  2034.         Returns: INTEGER, the value of its argument
  2035.         Notes:  Suspends execution of TE/2 for the duration in
  2036.                 milliseconds specified in its argument.
  2037.  
  2038.  
  2039.     SNAPSHOT(string)
  2040.         Returns: INTEGER
  2041.         Notes:  Performs the TE/2 SnapShot function saving its results
  2042.                 to the filename indicated in the parameter.  If the
  2043.                 parameter is "" the the screen capture is saved to the
  2044.                 default file name.  Snapshot always appends data to the
  2045.                 output file.  Returns zero on success or an error code
  2046.                 on failure.
  2047.  
  2048.     SPRINTF(string, ... )
  2049.         Returns: STRING
  2050.         Notes:  SPRINTF receives a format string in its first
  2051.                 argument followed by up to 10 additional arguments
  2052.                 that may be either integers or strings. The arguments
  2053.                 are formatted into a string according to rules
  2054.                 specified by embedded commands in the format string.
  2055.                 With the exception of floating point handling and
  2056.                 pointer notation, all of the functionality of the "C"
  2057.                 functions "printf" and "sprintf" are supported by
  2058.                 TE/2's implementation of SPRINTF, the reader is
  2059.                 referred to the C Language library reference manual of
  2060.                 his or her choice for complete definition of all of
  2061.                 the rules regarding format strings.  Here we will note
  2062.                 the following:
  2063.  
  2064.                   All characters from the format string are copied
  2065.                   to the output string with the following exceptions:
  2066.  
  2067.                   If "%s" is encountered in the format string, the
  2068.                   next unexamined parameter is interpreted as a
  2069.                   string an embedded at that point in the output
  2070.                   string.  The notation "%10s" will right justify the
  2071.                   string in a field of 10 spaces at that point in the
  2072.                   output string. "10" is used by way of example, it
  2073.                   may be any decimal number.  The notation "%-10s"
  2074.                   will likewise left justify the string in a field
  2075.                   of 10 spaces.
  2076.  
  2077.                   If "%d" is encountered in the format string, the
  2078.                   next unexamined parameter is interpreted as a
  2079.                   16 bit signed integer and the ascii representation
  2080.                   of it is embedded into the output string at that
  2081.                   point.  "%ld" interprets the numeric parameter as
  2082.                   a 32-bit signed integer (the native form of all
  2083.                   integers in the TE/2 script language).  "%10d" or
  2084.                   "%10ld" right justifies the number in a field of
  2085.                   10 spaces in the output string, "%010d" or "%010ld"
  2086.                   right justify the number in a field of ten zeros
  2087.                   in the output string.
  2088.  
  2089.                   If "%*s", "%-*s", "%*d", et cetera are encountered
  2090.                   in the format string, these will behave exactly the
  2091.                   same as the examples above with numeric values
  2092.                   except that TWO parameters are expected in the
  2093.                   argument list, the first an integer which will
  2094.                   specify the field width, the second the string or
  2095.                   integer to place in the output string.
  2096.  
  2097.                   If "%%" is encountered in the format string, a
  2098.                   single "%" is placed in the output string.
  2099.  
  2100.                 The arguments to SPRINTF may be literal strings,
  2101.                 string variables, string expressions, numeric
  2102.                 literals, constants, variables, or expressions
  2103.                 in any form or order.  The only restriction is that
  2104.                 the first argument, the format string, must evaluate
  2105.                 to a string.
  2106.  
  2107.                 WARNING
  2108.                 It is not possible to type check all of the
  2109.                 parameters in an SPRINTF (or MESSAGE or TRANSMIT)
  2110.                 argument list.  The script file writer is expected
  2111.                 to take precautions to avoid type mismatches so that
  2112.                 integers are not interpreted as strings and vice
  2113.                 versa.  In general, if a string is interpreted as an
  2114.                 integer there should be no ill effects other than
  2115.                 erroneous output.  If an integer is interpreted as
  2116.                 a string however, a protection violation may well
  2117.                 occur.
  2118.  
  2119.         Examples:
  2120.                 SPRINTF("Hello %s", "World")
  2121.                   returns "Hello World"
  2122.  
  2123.                 SPRINTF("Hello %8s", "world")
  2124.                   returns "Hello    world"
  2125.  
  2126.                 SPRINTF("Hello %-8s", "World")
  2127.                   returns "Hello World   "
  2128.  
  2129.                 SPRINTF("This is the %dth example", 4)
  2130.                   returns "This is the 4th example"
  2131.  
  2132.                 SPRINTF("Action is %03d%% %s", 35, "complete")
  2133.                   returns "Action is 035% complete"
  2134.  
  2135.  
  2136.  
  2137.     STATUS(void)
  2138.         Returns: INTEGER, always FALSE
  2139.         Notes:  This is equivalent to typing Alt-I from terminal mode.
  2140.  
  2141.  
  2142.     STREVAL(string)
  2143.         Returns: STRING, the value of its argument
  2144.         Notes:  This function is included as a convenience for the
  2145.                 REXX language script writer, it simply returns the
  2146.                 value of its argument allowing a REXX script to query
  2147.                 any TE/2 internal or global variable.
  2148.  
  2149.     STRCMP(string, string)
  2150.         Returns: INTEGER
  2151.         Notes:  Lexigraphically compares two strings, returns zero if
  2152.                 the strings are identical, less than zero if the
  2153.                 first string is "less than" the second, greater than
  2154.                 zero otherwise.
  2155.  
  2156.  
  2157.     STRGET(string, integer, integer, integer, integer, integer, integer)
  2158.         Returns: STRING, user response
  2159.         Notes:  String input routine.  The string parameter is the
  2160.                 default value, and the integer parameters are, in
  2161.                 order, row for the input, column for the input, width
  2162.                 of the input area, maximum input length (may be larger,
  2163.                 smaller or equal to the previous parameter), attribute
  2164.                 for 'first display' of the default, and attribute for
  2165.                 display while the user is editing/inputting.  Returns
  2166.                 the edited string, returns the empty string if the user
  2167.                 pressed ESCape.
  2168.                 Note that input area is NOT saved and restored, it will
  2169.                 remain on screen after the input.
  2170.  
  2171.  
  2172.     STRICMP(string, string)
  2173.         Returns: INTEGER
  2174.         Notes:  Case-insensitive version of STRCMP.  See STRCMP.
  2175.  
  2176.  
  2177.     STRLEFT(string, integer)
  2178.         Returns: STRING
  2179.         Notes:  Returns the leftmost N characters in the string where
  2180.                 N is the number specified in the second argument.  If
  2181.                 N is greater than the length of the string, the
  2182.                 entire string is returned. (see STRRIGHT, SUBSTR)
  2183.  
  2184.  
  2185.     STRLEN(string)
  2186.         Returns: INTEGER, the length of the string
  2187.  
  2188.  
  2189.     STRNSTR(string, string, integer)
  2190.         Returns: INTEGER
  2191.         Notes:  The integer parameter specifies a match count (n), this
  2192.                 function finds the n-th occurance of the second string
  2193.                 in the first.  STRNSTR(s1, s2, 1) is identical to
  2194.                 STRSTR(s1, s2).
  2195.  
  2196.     STRPUT(integer, integer, integer, string, ... )
  2197.         Returns: INTEGER, length of displayed string
  2198.         Notes:  The integer parameters are, in order, screen row,
  2199.                 screen column, and attribute for display.  The
  2200.                 string is a format string (see SPRINTF) which may
  2201.                 be followed by up to ten additional arguments.
  2202.                 The resulting string is placed at the indicated
  2203.                 position on screen using the indicated attribute.
  2204.                 Return value is the length of the displayed string.
  2205.  
  2206.  
  2207.     STRRIGHT(string, integer)
  2208.         Returns: STRING
  2209.         Notes:  Returns the rightmost N characters in the string where
  2210.                 N is the number specified in the second argument.  If
  2211.                 N is greater than the length of the string, the
  2212.                 entire string is returned. (see STRLEFT, SUBSTR)
  2213.  
  2214.  
  2215.     STRSTR(string, string)
  2216.         Returns: INTEGER
  2217.         Notes:  Scans the string in the first argument for an
  2218.                 occurrence of the string in the second.  Returns zero
  2219.                 if the string was not found else it returns the
  2220.                 position of the second string in the first.
  2221.  
  2222.  
  2223.     STRTRIM(string)
  2224.         Returns: STRING
  2225.         Notes:  Returns a string which is a copy of the string in
  2226.                 its argument with all leading space, tab, carriage
  2227.                 return, and newline characters removed from the
  2228.                 beginning and end.  Embedded spaces, etc., are not
  2229.                 removed.
  2230.  
  2231.  
  2232.     SUBSTR(string, integer, integer)
  2233.         Returns: STRING
  2234.         Notes:  Returns a substring of the string in its argument.
  2235.                 If N is the value of the second argument and M the
  2236.                 value of the third, SUBSTR returns the string which
  2237.                 begins N characters into the first argument and
  2238.                 continues for M characters.  If N is greater than the
  2239.                 length of the string, the empty string is returned,
  2240.                 if N+M is greater than the length of the string, only
  2241.                 the characters in the string from position N to the
  2242.                 end of the string are returned. (see STRLEFT and
  2243.                 STRRIGHT)
  2244.  
  2245.  
  2246.     TERMECHO(special)
  2247.         Returns: INTEGER, TRUE or FALSE
  2248.         Notes:  The special argument must be one of TRUE, FALSE, or
  2249.                 TOGGLE.  TERMECHO will enable or disable the echoing
  2250.                 of characters to the terminal screen.  This effects
  2251.                 both incoming characters from the comm port received
  2252.                 during a WAITFOR, MUXWAIT, RGETS, or RGETC and
  2253.                 characters typed at the keyboard during a GETS call.
  2254.                 It does NOT have any effect on characters received
  2255.                 during a main or higher level PROCESS.
  2256.         Example:
  2257.                 message("Enter string to wait for:")
  2258.                 termecho(FALSE)
  2259.                 waitSrch = gets(255)  ; no screen echo here
  2260.                 waitfor(waitSrch, 60) ; or here
  2261.                 process               ; screen will update during this
  2262.                                       ; but will still be off when we
  2263.                                       ; get back
  2264.  
  2265.  
  2266.     TERMWINDOW(integer, integer, integer, integer)
  2267.         Returns: INTEGER, TRUE on success, FALSE on error
  2268.         Notes:  The parameters specify, in order: row, columns, number
  2269.                 of rows, and number of columns for the new emulation
  2270.                 window.  This function resets the terminal window (a
  2271.                 subset of the physical screen) to the size and location
  2272.                 specified.  It's recommended that you perform a CLS()
  2273.                 before and after this call.  Take great care with this
  2274.                 one, it's a direct back door into the terminal emulation
  2275.                 handler.
  2276.  
  2277.     TOLOWER(string)
  2278.         Returns: STRING
  2279.         Notes:  Returns a string which is a copy of its argument
  2280.                 with all upper case letters translated to lower case.
  2281.                 (see TOUPPER)
  2282.  
  2283.  
  2284.     TOUPPER(string)
  2285.         Returns: STRING
  2286.         Notes:  Returns a string which is a copy of its argument
  2287.                 with all lower case letters translated to upper case.
  2288.                 (see TOLOWER)
  2289.  
  2290.  
  2291.     TRACE(integer)
  2292.         Returns: INTEGER, the value of its argument
  2293.         Notes:  Enables and disables trace mode during script file
  2294.                 execution.  When in trace mode each line of the
  2295.                 script file is printed on the terminal display (and
  2296.                 will appear in the scroll back buffer and log file
  2297.                 if one is open) as it is encountered.  This is a
  2298.                 global toggle, once turned on it is on for all
  2299.                 subsequent script file processing until it is turned
  2300.                 off again or until TE/2 ends.
  2301.  
  2302.  
  2303.     TRANSMIT(string, ... )
  2304.         Returns: INTEGER, the length of the message string
  2305.         Notes:  TRANSMIT takes a parameter list identical to the
  2306.                 SPRINTF function, refer to SPRINTF for a more
  2307.                 complete discussion of the format string and its
  2308.                 arguments.  This function will build a string
  2309.                 according to the rules for SPRINTF and transmit
  2310.                 it to the comm port.
  2311.  
  2312.  
  2313.     UNIQUEFNAME(string)
  2314.         Returns: STRING
  2315.         Notes:  Creates a temporary file name based on 'template' which
  2316.                 is a basename plus wildcard characters '?'.  For example:
  2317.                 C:\TEMP\FILE????.  The function does NOT open the file.
  2318.                 Returns the empty string if no new names could be generated.
  2319.  
  2320.     UPLOAD(special, string)
  2321.         Returns: INTEGER, TRUE or FALSE
  2322.         Notes:  The "special" parameter must be one of the following
  2323.                 pre-defined constants: ASCII, XMODEM, XMODEM1K,
  2324.                 YMODEM, YMODEMG, ZMODEM, or QUERY.  If this parameter
  2325.                 is QUERY, the user is prompted for the protocol.  The
  2326.                 second parameter is the file name, if it is the empty
  2327.                 string, the user is prompted for the file name.
  2328.                 The function returns TRUE if the file transfer ended
  2329.                 with no fatal errors.  (See DOWNLOAD)
  2330.  
  2331.  
  2332.     WAITFOR(string, integer)
  2333.         Returns: INTEGER, TRUE or FALSE
  2334.         Notes:  Does not return until either the string specified in
  2335.                 the first parameter is encountered at the comm port,
  2336.                 the duration in seconds specified in the second
  2337.                 parameter has elapsed, or the user types ESCape,
  2338.                 whichever occurs first.  Returns TRUE if the string
  2339.                 was encountered, FALSE if a timeout occurred or the
  2340.                 wait was aborted by typing ESCape.
  2341.                 Note that specifying a number less than zero as the
  2342.                 timeout parameter, timeout processing is disabled.
  2343.                 Incoming characters are echoed to the terminal screen
  2344.                 unless terminal display is turned off, the log file
  2345.                 is maintained.  (See MUXWAIT, WATCHFOR)
  2346.  
  2347.  
  2348.     WATCHFOR(string, string)
  2349.         Returns: INTEGER, 'handle' for installed watch
  2350.         Notes:  Unlike WAITFOR, which does not return until the
  2351.                 indicated string has been encountered or a set period
  2352.                 of time has elapsed, WATCHFOR installs an asynchronous
  2353.                 'watch' and returns immediately.  The return value is
  2354.                 zero if TE/2 could not install this watch, only 10
  2355.                 watches may be active at any time.  If successful,
  2356.                 the return value is a 'handle' which you will
  2357.                 need to pass to CANCELWATCH when you want to end
  2358.                 the watch.  This handle is therefore every bit as
  2359.                 precious as the handle returned from FOPEN and the
  2360.                 warnings given below in the notes about file handles
  2361.                 apply equally well to watch handles.
  2362.                 The first parameter is the string to 'watch' for.
  2363.                 The second parameter may be nearly any valid TE/2
  2364.                 Script Language assignment statement or function
  2365.                 call.  The statement is not checked for proper syntax
  2366.                 or variable usage until the watch string has been
  2367.                 matched and TE/2 attempts to execute the statement so
  2368.                 you must take care that the syntax is correct and
  2369.                 that any variables referred to in the statement will
  2370.                 be accessible when the statement is to be executed.
  2371.                 Global and system-global variables are always safe
  2372.                 but local variables will cause problems if the watch
  2373.                 is left to continue after the current script has
  2374.                 finished execution or during the execution of any
  2375.                 nested script files or recursive PROCESSes.
  2376.                 Every incoming character from the com port is checked
  2377.                 against the currently active watches, if a watch
  2378.                 string is matched it is tagged for execution.  If
  2379.                 TE/2 is in a process loop at the time, it will be
  2380.                 immediately executed.  However, if a script file
  2381.                 is running at the time, it will not execute until
  2382.                 the current line has finished execution - this means
  2383.                 that a WAITFOR, MUXWAIT, RGETS, RGETC, etc., will not
  2384.                 be interrupted to execute a watch command.
  2385.                 Use the function CANCELWATCH to release a watch that
  2386.                 is no longer needed. (See CANCELWATCH)
  2387.         Example:
  2388.  
  2389.                 integer whand1
  2390.                 integer whand2
  2391.                 integer gotMail = FALSE
  2392.  
  2393.                 program
  2394.                   whand1 = watchfor("ENTER to continue", "sendbyte(13)")
  2395.                   whand2 = watchfor("mail waiting", "gotMail = TRUE")
  2396.                   waitfor("Enter your choice:", 120)
  2397.                   cancelwatch(whand1)
  2398.                   cancelwatch(whand2)
  2399.                   if gotMail
  2400.                     ; et cetera
  2401.  
  2402.  
  2403.  
  2404.     WINDOWMINMAX(integer)
  2405.         Returns: INTEGER, 0 on success or an error value
  2406.         Notes: Sets TE/2's window state.  The integer parameter should be
  2407.                one of:
  2408.                   0 -> Minimize
  2409.                   1 -> Maximize
  2410.                   2 -> Restore
  2411.                This function not available if TE/2 is running in full
  2412.                screen mode
  2413.  
  2414.  
  2415.  
  2416. Special Notes on the File Handling Functions:
  2417. =============================================
  2418.  
  2419.   The integer value returned from FOPEN is a very important one.  It
  2420. is a file "handle" that is used for all actions performed on that
  2421. file via the other file oriented functions.  This value should NOT be
  2422. modified by your program until the file is safely closed (via a call
  2423. to FCLOSE) and is no longer needed.  Though all the other file
  2424. oriented functions other than FOPEN will accept any integer valued
  2425. expression in the field used for the file handle, it is VERY
  2426. dangerous to use anything but the variable containing the value
  2427. returned from FOPEN.  Any number of problems, up to and including
  2428. general protection violations, may occur is this procedure is not
  2429. followed.
  2430.  
  2431.   The valid open modes for a file that may be used as the second
  2432. argument to FOPEN are given in Table 6 below.  Certain of the file
  2433. oriented functions will operate only on a file which has been opened
  2434. in a mode which permits reading from the file.  FGETS, FGETC, are
  2435. examples of these functions.  Others, like FPUTS and FPUTC, will
  2436. operate only on a file which has been opened on a file which has been
  2437. opened in a mod which allows writing to the file.  Others, like
  2438. FCLOSE and FTELL will work on any open file.
  2439.  
  2440.  
  2441.         Table 6. -- Valid "mode" parameters for FOPEN
  2442.         ---------------------------------------------
  2443.  
  2444.           "r"   open for reading. If the file does not exist,
  2445.                 the FOPEN call will fail.
  2446.  
  2447.           "w"   open an empty file for writing.  If the given
  2448.                 file exists it will be truncated.
  2449.  
  2450.           "a"   open for writing at the end of file (appending)
  2451.                 create the file if it does not exist.
  2452.  
  2453.           "r+"  open for both reading and writing.  If the file
  2454.                 does not exist, the FOPEN call will fail.
  2455.  
  2456.           "w+"  open for both reading and writing.  If the given
  2457.                 file exists it will be truncated.
  2458.  
  2459.           "a+"  open for both reading and appending.  If the file
  2460.                 does not exist it will be created.
  2461.  
  2462.  
  2463.           Translation mode specifiers:
  2464.           ---------------------------
  2465.           One of the following characters may be optionally appended
  2466.           to the mode string, they control the translation mode of
  2467.           the file.  The default mode is "t" (translated) mode so
  2468.           that the use of "t" is unnecessary.
  2469.  
  2470.             "b"   open in binary (untranslated) mode.  Absolutely
  2471.                   no translation is performed on data read from or
  2472.                   written to the file.
  2473.  
  2474.             "t"   open in text (translated) mode.  Carriage return-
  2475.                   line feed combinations are translated to a single
  2476.                   line feed on input, line feed characters are
  2477.                   translated to carriage return-line feed pairs on
  2478.                   output.  Control-Z characters are considered to
  2479.                   be the end of file regardless of their position
  2480.                   in the physical file.  A file opened for writing
  2481.                   or read/writing will have a Control-Z found at the
  2482.                   end of the file removed if possible because the
  2483.                   presence of this character at the end of the file
  2484.                   may cause FSEEK to behave improperly.
  2485.                   Note that the return value of FTELL and the actions
  2486.                   of FSEEK may not be consistent with the actual
  2487.                   physical locations in a file opened in translated
  2488.                   mode.  However, they will behave compatibly, that
  2489.                   is,  FSEEKing to a location previously determined
  2490.                   by a call to FTELL will return the location pointer
  2491.                   to the same spot in the file.
  2492.  
  2493.                   Note: because "t" is the default action for FOPEN,
  2494.                   its use is discouraged.
  2495.  
  2496.  
  2497.  
  2498. Special Notes on Julian Date Conversion Functions:
  2499. ==================================================
  2500.  
  2501.   General notes on the calendars:
  2502.   -------------------------------
  2503.  
  2504.   Julian proleptic dates earlier than January 1, 4713 B.C. are
  2505. invalid, as are Julian dates in the year 0.  Gregorian dates prior to
  2506. October 15, 1582 are also invalid, as are dates with month numbers
  2507. not in the range 1 to 12, or with day numbers less than 1 or greater
  2508. than the number of days in that month.  Invalid dates will cause an
  2509. error return.
  2510.  
  2511.  
  2512.   Julian Date Conversion Functions:
  2513.   ---------------------------------
  2514.  
  2515.   JULIAN(integer packed_date, integer Gregorian)
  2516.   JULIAN2(integer mon, integer day, integer year, integer Gregorian)
  2517.  
  2518.   These two functions return the Julian Day Number corresponding to
  2519. the input calendar date or -1 if given an invalid input date.  If
  2520. parameter 'Gregorian' is non-zero, this denotes input as a Gregorian
  2521. calendar date, otherwise it is a Julian calendar date.  Note that, in
  2522. JULIAN, the date is given in the same packed format as the TE/2
  2523. Script Language read-only variable 'date', in JULIAN2 the date is
  2524. broken out into its componants.  Month ranges from 1 to 12, day from
  2525. 1 to 31 (or less depending on the month).  For Julian B.C. dates,
  2526. express the year as a negative number (remembering, there is no
  2527. Julian Year 0).  These function are, except as noted above,
  2528. identical.
  2529.  
  2530.  
  2531.   JDATE(integer JulianDay, integer Gregorian)
  2532.  
  2533.   Returns date, in packed format, if it can calculate it from the
  2534. Julian Day Number argument (JulianDay), or 0 if it cannot.  If valid,
  2535. the calculated month, day, and year are stored in the return value in
  2536. the same packed format as the TE/2 Script Language read-only variable
  2537. 'date'.  If parameter 'Gregorian' is non-zero, a Gregorian calendar
  2538. date will be calculated, otherwise a Julian calendar date is
  2539. calculated.
  2540.  
  2541.  
  2542.   JWDAY(integer JulianDay)
  2543.  
  2544.   Returns a day-of-week code (0 => Sunday, 1 => Monday, etc.) if
  2545. given a valid Julian Day Number, or -1 if the Julian Day Number is
  2546. invalid.
  2547.  
  2548.  
  2549.  
  2550. Notes on REXX Scripts
  2551. =====================
  2552.  
  2553.   You can call a REXX script from TE/2 anyplace you can call a TE/2
  2554. Script Language script!  TE/2 determines whether or not it's a REXX
  2555. script by examining the first two bytes of the file for "/*" (as all
  2556. good REXX files should begin) so you can name the file with a .SCR
  2557. if you want.  If it's not .SCR, you'll have to specify the full file
  2558. name.  REXX scripts also go into a directory referred to in the
  2559. ScriptPath .INI variable (see note below).
  2560.  
  2561.   A REXX script is executed directly (not via a shell to the command
  2562. processor) and the default addressing environment is set to 'TE2'.
  2563. As a subcommand handler, TE2 will accept any command that can be
  2564. typed at the Alt-/ Command Prompt (i.e, any TE/2 Script Language
  2565. assignment or function but not "if", "do .. loop" or any such control
  2566. construct).
  2567.  
  2568.   TE2 also registers itself to handle screen and keyboard i/o.  All
  2569. PULLs come from TE/2's keyboard handler and all, non debug, SAYs go
  2570. to TE/2 terminal screen.  Debug mode SAYs go to stderr as always.
  2571.  
  2572.   The return code for a REXX script is available to a calling TE/2
  2573. syntax script via the system global variable RexxRC.
  2574.  
  2575.  
  2576.   Calling a TE/2 Script language function from REXX:
  2577.   --------------------------------------------------
  2578.  
  2579.   Just put the call into quotes like you would if you were addressing
  2580.   CMD.EXE, the return value will be in RC.  E.g.,
  2581.  
  2582.      'upload(ZMODEM, "myfile.zip")'
  2583.      if rc = 1 ...
  2584.  
  2585.   Note the use of single and double quotes.  REXX will accept either but
  2586.   the TE/2 Script Language requires double quotes to delimit it's strings
  2587.   so you will have to watch for this.
  2588.  
  2589.   If you wanted to make the above UPLOAD call but had the file name in
  2590.   a REXX variable, call it as such:
  2591.  
  2592.      'upload(ZMODEM, "' rexxvar '")'
  2593.  
  2594.   If the TE/2 Script function returns a string instead of a numeric
  2595.   value, this also will be in rc.  E.g.,
  2596.  
  2597.      'rgets(250, 60, TRUE)'
  2598.      if rc = 'exit' ...
  2599.  
  2600.  
  2601.  
  2602.   Errors when calling TE/2:
  2603.   -------------------------
  2604.  
  2605.   After returning from calling a TE/2 Script Language function, the
  2606. REXX special variable RC is always set to the return value of the
  2607. function unless a syntax error of some sort occured.  TE/2 will print
  2608. an error message on the terminal screen in this event and raise a REXX
  2609. error condition (the value of RC is indetermanent in this case).  You
  2610. may want to use the REXX "SIGNAL ON ERROR ..." feature while debugging
  2611. scripts.
  2612.  
  2613.  
  2614.  
  2615.   Querying TE/2 Internal 'System' Variables:
  2616.   ------------------------------------------
  2617.  
  2618.   Clearly, because you aren't executing a TE/2 script language script,
  2619. you won't have any TE/2 local, user variables to deal with at all but
  2620. you may want to query a TE/2 system variable or perhaps a global variable
  2621. from a previously executed TE/2 Script Language script.
  2622.  
  2623.   If the variable is a string:  use the StrEval() function.
  2624.      'streval(downloadpath)'
  2625.      rxdlpath = rc
  2626.  
  2627.   If the variable is an integer: use the itoa() function.
  2628.      'itoa(kbdabort, 10)'
  2629.      if rc = 1 ...
  2630.  
  2631.  
  2632.  
  2633.   Setting a TE/2 Variable from REXX:
  2634.   ----------------------------------
  2635.  
  2636.   Some TE/2 System variables may be set by a script, all global user
  2637. variables may also be set.
  2638.  
  2639.   Set a string from a literal:
  2640.      'downloadpath = "D:\Junk"'
  2641.        -- or --
  2642.      'downloadpath = "' "D:\Junk" '"'
  2643.  
  2644.   Set a string from a variable:
  2645.      'downloadpath = "' rxvar '"'
  2646.  
  2647.   Set an integer from a literal:
  2648.      'localecho = 1'
  2649.         -- or --
  2650.      'localecho = ' 1
  2651.  
  2652.   Set an integer from a variable:
  2653.      'localecho = ' rxnumvar
  2654.  
  2655.  
  2656.